diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/GrMiscUtils.cmake | 17 | ||||
-rw-r--r-- | cmake/Modules/GrSwig.cmake | 2 |
2 files changed, 13 insertions, 6 deletions
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake index de2683d9c..540b97b93 100644 --- a/cmake/Modules/GrMiscUtils.cmake +++ b/cmake/Modules/GrMiscUtils.cmake @@ -187,11 +187,18 @@ endfunction(GR_LIBRARY_FOO) # and executables can depend on targets. So this is the process: ######################################################################## function(GR_GEN_TARGET_DEPS name var) - set(_dummy_target _${name}_dummy_target) - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_dummy_target}.cpp "int main(void){return 0;}\n") - add_executable(${_dummy_target} ${CMAKE_CURRENT_BINARY_DIR}/${_dummy_target}.cpp) + file( + WRITE ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in + "int main(void){return 0;}\n" + ) + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in + ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp + ) + add_executable(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp) if(ARGN) - add_dependencies(${_dummy_target} ${ARGN}) + add_dependencies(${name} ${ARGN}) endif(ARGN) - set(${var} "DEPENDS;${_dummy_target};COMMAND;${_dummy_target}" PARENT_SCOPE) + set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE) endfunction(GR_GEN_TARGET_DEPS) diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake index 1dfd62af2..4be583aa1 100644 --- a/cmake/Modules/GrSwig.cmake +++ b/cmake/Modules/GrSwig.cmake @@ -49,7 +49,7 @@ macro(GR_SWIG_MAKE name) #Create a dummy custom command that depends on other targets include(GrMiscUtils) - GR_GEN_TARGET_DEPS(${name} tag_deps ${GR_SWIG_TARGET_DEPS}) + GR_GEN_TARGET_DEPS(_${name}_swig_tag tag_deps ${GR_SWIG_TARGET_DEPS}) set(tag_file ${CMAKE_CURRENT_BINARY_DIR}/${name}.tag) add_custom_command( OUTPUT ${tag_file} |