Quellcode durchsuchen

cotire 1.6.1

master
Sascha Kratky vor 10 Jahren
Ursprung
Commit
03f64d36a0
5 geänderte Dateien mit 49 neuen und 18 gelöschten Zeilen
  1. +29
    -15
      CMake/cotire.cmake
  2. +5
    -0
      HISTORY.md
  3. +1
    -0
      MANUAL.md
  4. +13
    -2
      src/CMakeLists.txt
  5. +1
    -1
      src/main.cpp

+ 29
- 15
CMake/cotire.cmake Datei anzeigen

@@ -45,7 +45,7 @@ if (NOT CMAKE_SCRIPT_MODE_FILE)
endif()

set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
set (COTIRE_CMAKE_MODULE_VERSION "1.6.0")
set (COTIRE_CMAKE_MODULE_VERSION "1.6.1")

include(CMakeParseArguments)
include(ProcessorCount)
@@ -856,7 +856,7 @@ function (cotire_parse_includes _language _scanOutput _ignoredIncudeDirs _honore
# remove duplicate lines to speed up parsing
list (REMOVE_DUPLICATES _scanOutput)
list (LENGTH _scanOutput _uniqueLen)
if (COTIRE_VERBOSE)
if (COTIRE_VERBOSE OR COTIRE_DEBUG)
message (STATUS "Scanning ${_uniqueLen} unique lines of ${_len} for includes")
if (_ignoredExtensions)
message (STATUS "Ignored extensions: ${_ignoredExtensions}")
@@ -1408,29 +1408,36 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV
# GCC options used
# -include process include file as the first line of the primary source file
# -Winvalid-pch warns if precompiled header is found but cannot be used
# -isystem treat include directory as a system directory (i.e., suppress warnings from headers)
get_filename_component(_prefixDir "${_prefixFile}" PATH)
get_filename_component(_prefixName "${_prefixFile}" NAME)
if (_flags)
# append to list
list (APPEND _flags "-Winvalid-pch" "-isystem" "${_prefixDir}" "-include" "${_prefixName}")
list (APPEND _flags "-Winvalid-pch" "-include" "${_prefixFile}")
else()
# return as a flag string
set (_flags "-Winvalid-pch -isystem \"${_prefixDir}\" -include \"${_prefixName}\"")
set (_flags "-Winvalid-pch -include \"${_prefixFile}\"")
endif()
elseif (_compilerID MATCHES "Clang")
# Clang options used
# -include process include file as the first line of the primary source file
# -include-pch include precompiled header file
# -Qunused-arguments don't emit warning for unused driver arguments
# -isystem treat include directory as a system directory (i.e., suppress warnings from headers)
get_filename_component(_prefixDir "${_prefixFile}" PATH)
get_filename_component(_prefixName "${_prefixFile}" NAME)
if (_flags)
# append to list
list (APPEND _flags "-Qunused-arguments" "-isystem" "${_prefixDir}" "-include" "${_prefixName}")
if (_pchFile AND NOT CMAKE_${_language}_COMPILER MATCHES "ccache")
if (_flags)
# append to list
list (APPEND _flags "-Qunused-arguments" "-include-pch" "${_pchFile}")
else()
# return as a flag string
set (_flags "-Qunused-arguments -include-pch \"${_pchFile}\"")
endif()
else()
# return as a flag string
set (_flags "-Qunused-arguments -isystem \"${_prefixDir}\" -include \"${_prefixName}\"")
# no precompiled header, force inclusion of prefix header
# ccache requires the -include flag to be used in order to process precompiled header correctly
if (_flags)
# append to list
list (APPEND _flags "-Qunused-arguments" "-include" "${_prefixFile}")
else()
# return as a flag string
set (_flags "-Qunused-arguments -include \"${_prefixFile}\"")
endif()
endif()
elseif (_compilerID MATCHES "Intel")
if (WIN32)
@@ -1570,6 +1577,13 @@ function (cotire_check_precompiled_header_support _language _targetSourceDir _ta
else()
set (${_msgVar} "${_unsupportedCompiler}." PARENT_SCOPE)
endif()
if (CMAKE_${_language}_COMPILER MATCHES "ccache")
if (NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "time_macros")
set (${_msgVar}
"ccache requires the environment variable CCACHE_SLOPPINESS to be set to time_macros."
PARENT_SCOPE)
endif()
endif()
if (APPLE)
# PCH compilation not supported by GCC / Clang for multi-architecture builds (e.g., i386, x86_64)
if (CMAKE_CONFIGURATION_TYPES)


+ 5
- 0
HISTORY.md Datei anzeigen

@@ -1,3 +1,8 @@
## 1.6.1 (2014-04-20)

* fixed bug where precompiled headers did not work with Clang (thanks to nh2 for reporting).
* when using ccache, require that environment variable `CCACHE_SLOPPINESS` is set to `time_macros`.

## 1.6.0 (2014-03-16)

* suppress compiler warnings from precompiled headers.


+ 1
- 0
MANUAL.md Datei anzeigen

@@ -539,6 +539,7 @@ enabled in the following way upon configuring the project:

$ export CC="/usr/local/bin/ccache /usr/bin/gcc"
$ export CXX="/usr/local/bin/ccache /usr/bin/g++"
$ export CCACHE_SLOPPINESS=time_macros
$ cmake ..

Note that with ccache in order for precompiled headers to work properly, it is necessary to set


+ 13
- 2
src/CMakeLists.txt Datei anzeigen

@@ -2,8 +2,19 @@

add_executable(example main.cpp example.cpp log.cpp log.h example.h)

if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set_target_properties(example PROPERTIES COMPILE_FLAGS "-Wall")
# enable warnings
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set_target_properties(example PROPERTIES COMPILE_FLAGS "/Wall")
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_target_properties(example PROPERTIES COMPILE_FLAGS "-Weverything")
elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set_target_properties(example PROPERTIES COMPILE_FLAGS "-Wall -Wextra")
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Intel")
if (UNIX)
set_target_properties(example PROPERTIES COMPILE_FLAGS "-w5")
elseif (WIN32)
set_target_properties(example PROPERTIES COMPILE_FLAGS "/W5")
endif()
endif()

cotire(example)


+ 1
- 1
src/main.cpp Datei anzeigen

@@ -5,7 +5,7 @@
#include "example.h"
#include "log.h"

int main(int argc, char** argv)
int main()
{
std::string msg = example::get_message();
logging::info(msg);


Laden…
Abbrechen
Speichern