CMake Segfaults on function redefinition
Suppose I define a function like this:
function(INSTALL)
if (NOT NO_COMPILE_EXECUTABLES)
_INSTALL(${ARGN})
else()
endif()
endfunction()
Then, I include another CMake list, (probably from other CMake project) like this:
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/dependencies/myOtherPj
Then, in that CMake I've also redifined INSTALL, exactly in the same way
function(INSTALL)
if (NOT NO_COMPILE_EXECUTABLES)
_INSTALL(${ARGN})
else()
endif()
endfunction()
What I get:
cd build && cmake ..
-- The C compiler identification is GNU 4.9.4
-- The CXX compiler identification is GNU 4.9.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
/bin/sh: línea 1: 15363 Violación de segmento cmake ..
make: *** [Makefile:46: cmake] Error 139
This, also happens if I redefined add_custom_target
or add_executable
. Probably with others too, but untested.
More details:
Tested under CMake 3.7.2
and 3.6.3