Generator expression $<CONFIG> and install() in a subdirectory breaks Unix Makefiles generator
Using the generator expression $<CONFIG>
in the sources of add_executable
in a subdirectory and
using install
breaks the Unix Makefile generator.
Here is a simple example project (CMAKE_BUILD_TYPE
is defined in the root CMakeLists.txt
).:
The problematic statement is
add_executable ( BTest main.cpp part_$<CONFIG>.cpp )
install ( TARGETS BTest DESTINATION "bin" )
Calling cmake
(3.7.2 and current master) prints
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- 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
-- Configuring done
CMake Error at subDir/CMakeLists.txt:3 (add_executable):
Cannot find source file:
part_.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
-- Generating done
Oddly enough the problem disappears when the install
statement is removed.