Re: [CMake] Libraries with custom build command

2011-11-15 Thread Michael Hertling
On 11/14/2011 08:11 PM, Mathias Gaunard wrote: What is the recommended way to define libraries with custom build commands? This trick seems to be the only way: if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp) endif()

[CMake] Libraries with custom build command

2011-11-14 Thread Mathias Gaunard
What is the recommended way to define libraries with custom build commands? This trick seems to be the only way: if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp) endif() add_library(foo dummy.cpp) add_custom_command(TARGET foo POST_BUILD