[CMake] Problems with project file regeneration using VS 2008
Mika Fischer
mika.fischer at zoopnet.de
Fri Aug 1 09:46:14 EDT 2008
Hi,
I'm using the following code to copy header files from the source tree
into the build tree, on the way configuring config.h:
#######################################################################
# Copy includes to build directory, generating config.h
#######################################################################
FILE(GLOB_RECURSE FILES RELATIVE
"${CMAKE_SOURCE_DIR}/include"
"${CMAKE_SOURCE_DIR}/include/*")
FOREACH(FILE ${FILES})
IF (${FILE} MATCHES "\\.h(pp)?\$")
IF (${FILE} MATCHES "config\\.h\$")
MESSAGE("Configuring ${FILE}")
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/include/${FILE}
${CMAKE_BINARY_DIR}/include/${FILE}
ESCAPE_QUOTES
@ONLY)
ELSE (${FILE} MATCHES "config\\.h\$")
MESSAGE("Copying ${FILE}")
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/include/${FILE}
${CMAKE_BINARY_DIR}/include/${FILE}
COPYONLY)
ENDIF (${FILE} MATCHES "config\\.h\$")
GET_FILENAME_COMPONENT(DIR include/${FILE} PATH)
INSTALL(FILES ${CMAKE_BINARY_DIR}/include/${FILE}
DESTINATION ${DIR})
ENDIF (${FILE} MATCHES "\\.h(pp)?\$")
ENDFOREACH(FILE ${FILES})
This works fine under Linux, but with VS 2008, I always get prompted to
reload the project files after the headers have been copied. If I only
configure the config.h, or if I remove the whole copying step, it works
fine.
Sometimes the error comes from the parallel build feature of VS. In that
case two CMake instance run at the same time and try to copy the files.
But even if I disable the parallel build, CMake will run again and again
at different points during the build, every time prompting to reload the
project.
The message before CMake runs is: "CMake is re-running due to explicit
user request.", which is strange, because I certainly did not request it
to be run.
Any help in solving this would be greatly appreciated!
Regards,
Mika
More information about the CMake
mailing list