diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9de77583..3da1ead7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -148,11 +148,14 @@ ecm_generate_headers( ) # Combine required headers into 1 big convenience header set(COMMON_HEADER ${CMAKE_CURRENT_BINARY_DIR}/KDChart/KDChart) -file(WRITE ${COMMON_HEADER} "// convenience header\n") +# (use a tmp file and configure_file to avoid touching the header unnecessarily) +set(COMMON_HEADER_TMP ${COMMON_HEADER}.tmp) +file(WRITE ${COMMON_HEADER_TMP} "// convenience header\n") foreach(_header ${kdchart_HEADERS}) get_filename_component(_base ${_header} NAME) - file(APPEND ${COMMON_HEADER} "#include \"${_base}\"\n") + file(APPEND ${COMMON_HEADER_TMP} "#include \"${_base}\"\n") endforeach() +configure_file("${COMMON_HEADER_TMP}" "${COMMON_HEADER}" COPYONLY) list(APPEND kdchart_HEADERS "${COMMON_HEADER}") configure_file("${COMMON_HEADER}" "${COMMON_HEADER}.h" COPYONLY) list(APPEND kdchart_HEADERS "${COMMON_HEADER}.h")