diff --git a/src/App/CMakeLists.txt b/src/App/CMakeLists.txt index a712c75e94..6b826c81c8 100644 --- a/src/App/CMakeLists.txt +++ b/src/App/CMakeLists.txt @@ -17,6 +17,8 @@ add_definitions(-DBOOST_${Boost_VERSION}) #if you want to use the old DAG structure uncomment this line #add_definitions(-DUSE_OLD_DAG) +# ----------------------------------------------------------------------------- + #write relevant cmake variables to a file for later access with python. Exportet are all variables #starting with BUILD. As the variable only exists if the user set it to ON a dict is useless, we #use a python list for export. @@ -34,7 +36,14 @@ foreach (_variableName ${_variableNames}) endif () endforeach() set(_vars "${_vars}]\\n\" \n;") -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CMakeScript.h "${_vars}" ) +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CMakeScript.hh "${_vars}" ) + +fc_copy_file_if_different( + "${CMAKE_CURRENT_BINARY_DIR}/CMakeScript.hh" + "${CMAKE_CURRENT_BINARY_DIR}/CMakeScript.h" +) + +# ----------------------------------------------------------------------------- include_directories( ${CMAKE_BINARY_DIR}/src diff --git a/src/Base/CMakeLists.txt b/src/Base/CMakeLists.txt index 73edf0738d..2bbf762881 100644 --- a/src/Base/CMakeLists.txt +++ b/src/Base/CMakeLists.txt @@ -94,23 +94,11 @@ if(SWIG_FOUND) # If the files are different or if swigpyrun.h doesn't exist then copy swigpyrun.hh. # This is to avoid to having to build the target each time cmake configure is executed. execute_process(COMMAND ${SWIG_EXECUTABLE} -python -external-runtime ${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.hh) - if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.h") - execute_process( - COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.hh - ${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.h - RESULT_VARIABLE DIFFERENT_FILES - OUTPUT_QUIET - ERROR_QUIET - ) - if (DIFFERENT_FILES) - execute_process(COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.hh" - "${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.h") - endif() - else() - execute_process(COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.hh" - "${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.h") - endif() + fc_copy_file_if_different( + "${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.hh" + "${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.h" + ) add_definitions(-DHAVE_SWIG=1) endif(SWIG_FOUND)