First, my cmake code does this:
sets ${metals} from a cmake command-line argument
compares the contents of ${metals} against the contents of a file to note
whether the variable is being changed since the last run of cmake
writes the new value to that file for next time
call an add_timestamp_file_target function. which touches the file
metalsTimestamp if the variable is being changed or if the file doesn’t exist.
Then comes this:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMETALS=\"\\\"${metals}\\\"\"")
add_executable (metals metals.cc <http://metals.cc/>)
add_dependencies (metals metalsTimestamp)
My add_timestamp_file_target function has to use one of
add_custom_target
add_custom_command
to make metalsTimestamp visible to the add_dependencies function.
Problem is, it seems that those commands have to touch the file every time
cmake runs, but I want to touch it only when necessary.
Is there a way to make this work?
--
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://public.kitware.com/mailman/listinfo/cmake