I try to write a cmake file for some external library (from the sparse
suite).
In the provided makefile a single source file is compiled twice with
different compiler flags, e.g.,
$(C) -DDINT -c ../Source/amd_aat.c -o amd_i_aat.o
$(C) -DDLONG -c ../Source/amd_aat.c -o amd_l_aat.o
and finally all object files are combined in a single library.
In my CMakeLists.txt I set the list of source files
SET(AMD_SRC
${AMD_SOURCE_DIR}/Source/amd_aat.c
...)
generate the names for the output files as follows
STRING(REGEX REPLACE "amd_" "amd_i_" AMDI_SRC ${AMD_SRC})
STRING(REGEX REPLACE "amd_" "amd_l_" AMDL_SRC ${AMD_SRC})
and specify the compiler flags accordingly
SET_SOURCE_FILES_PROPERTIES({AMDI_SRC} PROPERTIES COMPILE_FLAGS "-DDINT")
SET_SOURCE_FILES_PROPERTIES({AMDL_SRC} PROPERTIES COMPILE_FLAGS "-DDLONG")
However, the problem is that there are no physical source files named,
e.g. amd_i_aat.c, and hence, CMake produces the following obvious error
message:
CMake Error in CMakeLists.txt:
Cannot find source file "amd_i_aat.c". Tried extensions .c .C .c++
.cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx
Is is possible to tell CMake that the name of the source file differs
from that of the output file?
Best regards,
Matthias
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake