Patrick Noffke wrote:
Indeed, I use CONFIGURE_FILE() to replace paths to tools and source files in an XML file. I'm using WiX to make a windows installer package, and this required an XML file to describe the project. I need to package things like Qt DLLs, my applications translation files, and other components whose paths I do not know until build time.Is there a better way to solve such a problem on Windows? Do your substitutions at build time with a CMake script. Example: in your CMakeLists.txt: ADD_CUSTOM_TARGET(configure DEPENDS ${MY_DEPS} # Note that -P must be the last flag, or the -D flags won't work. COMMAND ${CMAKE_COMMAND} -DChicken_SOURCE_DIR=${Chicken_SOURCE_DIR} -P ${Chicken_SOURCE_DIR}/replace.cmake ) in a file replace.cmake: FILE(READ ${Chicken_SOURCE_DIR}/configure.in input) STRING(REPLACE "%pkgdatadir%" "${INSTALL_HOME}" input "${input}") FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/csc.scm "${input}") I pass Chicken_SOURCE_DIR because a CMake script has no knowledge or context of the caller's variables. The only thing it does know is CMAKE_CURRENT_BINARY_DIR, the directory in which it was invoked. The lack of context is actually useful in some instances, like resolving a circular compiler bootstrap dependency. Cheers, Brandon Van Every |
_______________________________________________ CMake mailing list [email protected] http://www.cmake.org/mailman/listinfo/cmake
