Consider the following CMakeLists.txt file (on a Mac, 10.9.1, Xcode 5, Unix
Makefiles generator):
cmake_minimum_required(VERSION 2.8.12)
project(CustomCommandTest)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test.cpp
COMMAND echo "#include <iostream>" > ${CMAKE_CURRENT_BINARY_DIR}/test.cpp
COMMAND echo "" >> ${CMAKE_CURRENT_BINARY_DIR}/test.cpp
COMMAND echo "int main()" >> ${CMAKE_CURRENT_BINARY_DIR}/test.cpp
COMMAND echo "{" >> ${CMAKE_CURRENT_BINARY_DIR}/test.cpp
COMMAND echo " std::cout << \"Hello World\" << std::endl;" >>
${CMAKE_CURRENT_BINARY_DIR}/test.cpp
COMMAND echo " return 0;" >> ${CMAKE_CURRENT_BINARY_DIR}/test.cpp
COMMAND echo "}" >> ${CMAKE_CURRENT_BINARY_DIR}/test.cpp
COMMAND echo "" >> ${CMAKE_CURRENT_BINARY_DIR}/test.cpp
VERBATIM
)
add_executable(customcommandtest ${CMAKE_CURRENT_BINARY_DIR}/test.cpp)
add_custom_command(TARGET customcommandtest POST_BUILD
COMMAND $<$<CONFIG:Release>:strip -u -r customcommandtest>
)
The custom command for the POST_BUILD step should invoke strip to strip the
binary of symbols.
Instead the following output is produced:
Linking CXX executable customcommandtest
/Users/stevew/cmake/install/bin/cmake -E cmake_link_script
CMakeFiles/customcommandtest.dir/link.txt --verbose=1
/usr/bin/c++ -O3 -DNDEBUG -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
-Wl,-search_paths_first -Wl,-headerpad_max_install_names
CMakeFiles/customcommandtest.dir/test.cpp.o -o customcommandtest
"\$<1:strip" -u -r customcommandtest>
Note the "\$<1:strip" -u -r customcommandtest> output from the generator
expression.
What do I need to change in the POST_BUILD custom command to make the
generator expression work correctly?
Thanks,
Steve
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake