I want to generate some compile time constants. The first answer to another question gets me quite close. From my CMakeLists.txt:
add_library(${PROJECT_NAME} STATIC ${CXX_SRCS} compile_time.hpp)
add_custom_command(OUTPUT compile_time.hpp
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/compile_time.cmake)
This works in the sense that the first time I run make
, it generates compile_time.hpp
, so that the values of the variables are defined when I run make
and not cmake
. But compile_time.hpp
is not remade when I rerun make
or even cmake
to redo the makefiles.
How can I make the target compile_time.cpp
be marked as phony
so that it is always remade? I tried
add_custom_target(compile_time.hpp)
to no effect.