From 1b680fe697d741dbd46eb59eee6f2f09e3dde040 Mon Sep 17 00:00:00 2001 From: Sascha Kratky Date: Sat, 22 Sep 2012 16:26:47 +0200 Subject: [PATCH] cotire 1.1.6 --- CMake/cotire.cmake | 11 +++++++++-- HISTORY.md | 6 ++++++ MANUAL.md | 26 +++++++++++++++++++++++++- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/CMake/cotire.cmake b/CMake/cotire.cmake index 2936fee..6260bbe 100644 --- a/CMake/cotire.cmake +++ b/CMake/cotire.cmake @@ -44,7 +44,7 @@ if (NOT CMAKE_SCRIPT_MODE_FILE) endif() set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}") -set (COTIRE_CMAKE_MODULE_VERSION "1.1.5") +set (COTIRE_CMAKE_MODULE_VERSION "1.1.6") include(CMakeParseArguments) @@ -943,7 +943,11 @@ function (cotire_scan_includes _includesVar) # cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared unset (ENV{VS_UNICODE_OUTPUT}) endif() - execute_process(COMMAND ${_cmd} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" OUTPUT_QUIET ERROR_VARIABLE _output) + execute_process(COMMAND ${_cmd} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE _result OUTPUT_QUIET ERROR_VARIABLE _output) + if (_result) + message (STATUS "Result ${_result} scanning includes of ${_existingSourceFiles}.") + endif() cotire_parse_includes( "${_option_LANGUAGE}" "${_output}" "${_option_IGNORE_PATH}" "${_option_INCLUDE_PATH}" @@ -2030,6 +2034,9 @@ function (cotire_setup_pch_target _languages _configurations _target) cotire_init_target("${_pchTargetName}") cotire_add_to_pch_all_target(${_pchTargetName}) endif() + else() + # for other generators, we add the "clean all" target to clean up the precompiled header + cotire_setup_clean_all_target() endif() endfunction() diff --git a/HISTORY.md b/HISTORY.md index bf78bd4..c2e9dda 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,9 @@ +## 1.1.6 (2012-09-22) + +* check result code upon scanning includes. +* always add a `clean_cotire` target to easily clean up cotire generated files. +* add section on `extern "C"` linkage issues to manual. + ## 1.1.5 (2012-08-17) * new cache variable `COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS` can be set to globally exclude diff --git a/MANUAL.md b/MANUAL.md index 2620a18..ed2ad35 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -296,7 +296,7 @@ ignore other project related headers in `CMAKE_SOURCE_DIR`: The properties `COTIRE_PREFIX_HEADER_IGNORE_PATH` and `COTIRE_PREFIX_HEADER_INCLUDE_PATH` can also be set on directories. -The following cache variables also affect the selection of prefix headers. +The following cache variables also affect the selection of prefix headers: * Directory paths in `COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_PATH` will be added to the list of ignored directories when the prefix header file is created. @@ -312,6 +312,30 @@ precompiled header and would result in a rebuild of the whole target. To make th creation dependent on changes to certain target source files, the source file property `COTIRE_DEPENDENCY` can be set to `TRUE` for those files. +### fixing linkage issues + +When a C++ program uses `extern "C"` on a system header file, cotire will not be able to detect +that the include file needs C linkage and will include the file with C++ linkage in the generated +prefix header instead. For example, the C interface to BLAS `cblas.h` usually has to be included +as `extern "C"` in a C++ program: + + extern "C" { + #include + } + +The presence of `extern "C"` includes will prevent cotired targets from being linked successfully +because of unresolved function references using the wrong linkage. To work around the problem, +the property `COTIRE_PREFIX_HEADER_IGNORE_PATH` can be set to a list including the full path of +the `extern "C"` header file. Here's an example: + + set_property(DIRECTORY + PROPERTY COTIRE_PREFIX_HEADER_IGNORE_PATH + "${ATLAS_INCLUDE_DIR}/cblas.h" + "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}") + +That way `cblas.h` will not be included in the generated prefix header and will not cause problems +upon linking. + ### configuring the generation of the unity source By default cotire adds all target source file to the generated unity source. In most cases a