reduce compile time after each time cmake configure is executed

This commit is contained in:
wmayer
2018-08-21 13:53:33 +02:00
parent 2912fd7c62
commit 0b3db26b24
2 changed files with 14 additions and 17 deletions

View File

@@ -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)