cmakepp icon indicating copy to clipboard operation
cmakepp copied to clipboard

SegFault when overwriting cmake functions

Open M1cha opened this issue 10 years ago • 9 comments

If I override functions like add_library or add_executable, cmake stops with a segfault

example code: macro(add_library _target) _add_library (${_target} ${ARGN}) endmacro()

M1cha avatar Jul 25 '15 09:07 M1cha

Hi, Thanks for reporting the issue. Could you tell me on what OS You are? I am assuming Linux . I will try to reproduce it and find a Solution. It might also be a cmake Bug.

toeb avatar Jul 26 '15 12:07 toeb

Yes I'm using Linux :)

M1cha avatar Jul 26 '15 13:07 M1cha

Hi, sorry its taken so long for a response.

I've tried it on linux and I can't seem to reproduce your error. Is your project available publicly? Then I might be able to debu it to find a solution. However it does seem to me that this is a CMake internal problem where I can only do so much.

toeb avatar Aug 03 '15 07:08 toeb

Btw when I encounter segfaults in cmake Its usually me creating infinite recursion

toeb avatar Aug 03 '15 18:08 toeb

yes it's public: https://github.com/amarullz/libaroma It doesn't use cmakepp atm, ut when u add it and overwrite a internal function(which it currently doesn't do either) it will crash.

I thought about a loop too, but I have no idea how to debug cmake scripts.

M1cha avatar Aug 03 '15 20:08 M1cha

well cmake debugging sucks.... because it does not exist :) but I'll try to find your problem as soon as possible. (as this shed light on #118 )

toeb avatar Aug 05 '15 08:08 toeb

If you not using my function overrides for cmake functions (like add_library, ... etc) you can take them out of the cmakepp source code (if you are using the single file version just remove the function or if you are using the multifile version then delete the function files which are located in cmake/targets/overrides)

This might be a quick fix if you only want to use part of cmakepp (what do you want to use specifically?)

toeb avatar Aug 05 '15 08:08 toeb

I want to misuse cmake scripts as my own generator. I want to use cmakepp's template engine to generate Android.mk files and to know what targets etc are defined I need to overwrite pretty much every important cmake function.

M1cha avatar Aug 05 '15 12:08 M1cha

Ok. well if you're interested in a quick fix which perform yourself you can just remove any unnecessary functions from cmakepp - template generation does not have many dependencies. I will be looking into it this week.

toeb avatar Aug 05 '15 12:08 toeb