summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeCUDACompiler.cmake.in2
-rw-r--r--Modules/CMakeCUDACompilerABI.cu2
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake12
-rw-r--r--Modules/CMakeDetermineASM_NASMCompiler.cmake17
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake34
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake47
-rw-r--r--Modules/CPackWIX.cmake11
-rw-r--r--Modules/Compiler/GNU-CXX.cmake3
-rw-r--r--Modules/FeatureSummary.cmake61
-rw-r--r--Modules/FindGTest.cmake60
-rw-r--r--Modules/FindProtobuf.cmake27
-rw-r--r--Modules/GoogleTest.cmake73
12 files changed, 248 insertions, 101 deletions
diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in
index 158d12b..f524e5f 100644
--- a/Modules/CMakeCUDACompiler.cmake.in
+++ b/Modules/CMakeCUDACompiler.cmake.in
@@ -16,6 +16,8 @@ set(CMAKE_CUDA_SOURCE_FILE_EXTENSIONS cu)
set(CMAKE_CUDA_LINKER_PREFERENCE 15)
set(CMAKE_CUDA_LINKER_PREFERENCE_PROPAGATES 1)
+set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "@CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES@")
+
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES@")
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES@")
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
diff --git a/Modules/CMakeCUDACompilerABI.cu b/Modules/CMakeCUDACompilerABI.cu
index 5aa1b8a..99bacef 100644
--- a/Modules/CMakeCUDACompilerABI.cu
+++ b/Modules/CMakeCUDACompilerABI.cu
@@ -1,5 +1,5 @@
#ifndef __CUDACC__
-# error "A C or C++ compiler has been selected for CUDA"
+#error "A C or C++ compiler has been selected for CUDA"
#endif
#include "CMakeCompilerABI.h"
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index 4162726..7d5e2b2 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -92,9 +92,17 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ARMCC )
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ARMCC "(ARM Compiler)|(ARM Assembler)")
- include(CMakeDetermineCompilerId)
- CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT})
+ list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS NASM)
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_NASM "-v")
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_NASM "(NASM version)")
+
+ list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS YASM)
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_YASM "--version")
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_YASM "(yasm)")
+ include(CMakeDetermineCompilerId)
+ set(userflags)
+ CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT} "${userflags}")
endif()
if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
diff --git a/Modules/CMakeDetermineASM_NASMCompiler.cmake b/Modules/CMakeDetermineASM_NASMCompiler.cmake
index 4c8e422..dd75310 100644
--- a/Modules/CMakeDetermineASM_NASMCompiler.cmake
+++ b/Modules/CMakeDetermineASM_NASMCompiler.cmake
@@ -7,8 +7,21 @@
set(CMAKE_ASM_NASM_COMPILER_LIST nasm yasm)
if(NOT CMAKE_ASM_NASM_COMPILER)
- find_program(CMAKE_ASM_NASM_COMPILER nasm
- "$ENV{ProgramFiles}/NASM")
+ set(_CMAKE_ENV_VARX86 "ProgramFiles(x86)")
+ set(_CMAKE_ASM_NASM_COMPILER_PATHS
+ "[HKEY_CURRENT_USER\\SOFTWARE\\nasm]"
+ "$ENV{ProgramFiles}/NASM"
+ "$ENV{${ENV_VARX86}}/NASM"
+ "$ENV{LOCALAPPDATA}/NASM"
+ )
+ find_program(CMAKE_ASM_NASM_COMPILER
+ NAMES ${CMAKE_ASM_NASM_COMPILER_LIST}
+ PATHS ${_CMAKE_ASM_NASM_COMPILER_PATHS}
+ NO_DEFAULT_PATH
+ DOC "NASM compiler"
+ )
+ unset(_CMAKE_ENV_VARX86)
+ unset(_CMAKE_ASM_NASM_COMPILER_PATHS)
endif()
# Load the generic DetermineASM compiler file with the DIALECT set properly:
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index bef6d0e..7b6d17b 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -84,20 +84,20 @@ endif()
#the compiler with cuda-fake-ld and pass too CMAKE_PARSE_IMPLICIT_LINK_INFO
if(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA)
set(_nvcc_log "")
- string(REPLACE "\r" "" _nvcc_output "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
- if(_nvcc_output MATCHES "#\\\$ +LIBRARIES= *([^\n]*)\n")
+ string(REPLACE "\r" "" _nvcc_output_orig "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
+ if(_nvcc_output_orig MATCHES "#\\\$ +LIBRARIES= *([^\n]*)\n")
set(_nvcc_libraries "${CMAKE_MATCH_1}")
string(APPEND _nvcc_log " found 'LIBRARIES=' string: [${_nvcc_libraries}]\n")
else()
set(_nvcc_libraries "")
- string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output}")
+ string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}")
string(APPEND _nvcc_log " no 'LIBRARIES=' string found in nvcc output:${_nvcc_output_log}\n")
endif()
set(_nvcc_link_line "")
if(_nvcc_libraries)
# Remove variable assignments.
- string(REGEX REPLACE "#\\\$ *[^= ]+=[^\n]*\n" "" _nvcc_output "${_nvcc_output}")
+ string(REGEX REPLACE "#\\\$ *[^= ]+=[^\n]*\n" "" _nvcc_output "${_nvcc_output_orig}")
# Split lines.
string(REGEX REPLACE "\n+(#\\\$ )?" ";" _nvcc_output "${_nvcc_output}")
foreach(line IN LISTS _nvcc_output)
@@ -150,6 +150,32 @@ if(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA)
message(FATAL_ERROR "Failed to extract nvcc implicit link line.")
endif()
+ set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES )
+ if(_nvcc_output_orig MATCHES "#\\\$ +INCLUDES= *([^\n]*)\n")
+ set(_nvcc_includes "${CMAKE_MATCH_1}")
+ string(APPEND _nvcc_log " found 'INCLUDES=' string: [${_nvcc_includes}]\n")
+ else()
+ set(_nvcc_includes "")
+ string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}")
+ string(APPEND _nvcc_log " no 'INCLUDES=' string found in nvcc output:${_nvcc_output_log}\n")
+ endif()
+ if(_nvcc_includes)
+ # across all operating system each include directory is prefixed with -I
+ separate_arguments(_nvcc_output UNIX_COMMAND "${_nvcc_includes}")
+ foreach(line IN LISTS _nvcc_output)
+ string(REGEX REPLACE "^-I" "" line "${line}")
+ get_filename_component(line "${line}" ABSOLUTE)
+ list(APPEND CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "${line}")
+ endforeach()
+
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Parsed CUDA nvcc include information from above output:\n${_nvcc_log}\n${log}\n\n")
+ else()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Failed to detect CUDA nvcc include information:\n${_nvcc_log}\n\n")
+ endif()
+
+
endif()
# configure all variables set in this file
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index bb34de5..ae485bf 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -24,16 +24,21 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
# Try building with no extra flags and then try each set
# of helper flags. Stop when the compiler is identified.
- foreach(flags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}
- ""
- ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
- CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}")
- CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR("${lang}" "${COMPILER_${lang}_PRODUCED_OUTPUT}")
- if(CMAKE_${lang}_COMPILER_ID)
- break()
- endif()
- foreach(file ${COMPILER_${lang}_PRODUCED_FILES})
- CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}")
+ foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
+ foreach(testflags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}
+ ""
+ ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
+ CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${testflags}" "${userflags}" "${src}")
+ CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR("${lang}" "${COMPILER_${lang}_PRODUCED_OUTPUT}")
+ if(CMAKE_${lang}_COMPILER_ID)
+ break()
+ endif()
+ foreach(file ${COMPILER_${lang}_PRODUCED_FILES})
+ CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}")
+ endforeach()
+ if(CMAKE_${lang}_COMPILER_ID)
+ break()
+ endif()
endforeach()
if(CMAKE_${lang}_COMPILER_ID)
break()
@@ -42,7 +47,9 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
# If the compiler is still unknown, try to query its vendor.
if(CMAKE_${lang}_COMPILER AND NOT CMAKE_${lang}_COMPILER_ID)
- CMAKE_DETERMINE_COMPILER_ID_VENDOR(${lang})
+ foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
+ CMAKE_DETERMINE_COMPILER_ID_VENDOR(${lang} "${userflags}")
+ endforeach()
endif()
if (COMPILER_QNXNTO AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU")
@@ -66,7 +73,9 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endif()
if(CMAKE_GENERATOR STREQUAL "Ninja" AND MSVC_${lang}_ARCHITECTURE_ID)
- CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX(${lang})
+ foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
+ CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX(${lang} "${userflags}")
+ endforeach()
else()
set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "")
endif()
@@ -127,7 +136,7 @@ endfunction()
#-----------------------------------------------------------------------------
# Function to build the compiler id source file and look for output
# files.
-function(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags src)
+function(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags userflags src)
# Create a clean working directory.
file(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR})
file(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR})
@@ -137,7 +146,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags src)
# Construct a description of this test case.
set(COMPILER_DESCRIPTION
"Compiler: ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_ARG1}
-Build flags: ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
+Build flags: ${userflags}
Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
")
@@ -327,7 +336,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
execute_process(
COMMAND "${CMAKE_${lang}_COMPILER}"
${CMAKE_${lang}_COMPILER_ID_ARG1}
- ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
+ ${userflags}
${testflags}
${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
"${src}"
@@ -615,7 +624,7 @@ endfunction()
# set(CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor} "Some Vendor Output")
# We try running the compiler with the flag for each vendor and
# matching its regular expression in the output.
-function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
+function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang userflags)
if(NOT CMAKE_${lang}_COMPILER_ID_DIR)
# We get here when this function is called not from within CMAKE_DETERMINE_COMPILER_ID()
@@ -633,7 +642,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
execute_process(
COMMAND "${CMAKE_${lang}_COMPILER}"
${CMAKE_${lang}_COMPILER_ID_ARG1}
- ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
+ ${userflags}
${flags}
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
OUTPUT_VARIABLE output ERROR_VARIABLE output
@@ -661,7 +670,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
endforeach()
endfunction()
-function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang)
+function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang userflags)
# Run this MSVC-compatible compiler to detect what the /showIncludes
# option displays. We can use a C source even with the C++ compiler
# because MSVC-compatible compilers handle both and show the same output.
@@ -671,7 +680,7 @@ function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang)
execute_process(
COMMAND "${CMAKE_${lang}_COMPILER}"
${CMAKE_${lang}_COMPILER_ID_ARG1}
- ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
+ ${userflags}
/nologo /showIncludes /c main.c
WORKING_DIRECTORY ${showdir}
OUTPUT_VARIABLE out
diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake
index 0f2278f..5a36e4c 100644
--- a/Modules/CPackWIX.cmake
+++ b/Modules/CPackWIX.cmake
@@ -268,6 +268,17 @@
# follow the localization or convention of the system on which the
# installation is performed.
#
+# .. variable:: CPACK_WIX_ROOT_FOLDER_ID
+#
+# This variable allows specification of a custom root folder ID.
+# The generator specific ``<64>`` token can be used for
+# folder IDs that come in 32-bit and 64-bit variants.
+# In 32-bit builds the token will expand empty while in 64-bit builds
+# it will expand to ``64``.
+#
+# When unset generated installers will default installing to
+# ``ProgramFiles<64>Folder``.
+#
if(NOT CPACK_WIX_ROOT)
file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT)
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index c007c98..2499d2f 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -11,8 +11,7 @@ else()
endif()
endif()
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
- # Supported since 4.3
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
endif()
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index f29a5f0..1b93304 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -63,6 +63,16 @@ is set for all the packages.
The default value for this global property is ``OPTIONAL``.
+
+.. variable:: FeatureSummary_<TYPE>_DESCRIPTION
+
+The global property :variable:`FeatureSummary_<TYPE>_DESCRIPTION` can be defined
+for each type to replace the type name with the specified string whenever the
+package type is used in an output string.
+
+If not set, the string "``<TYPE>`` packages" is used.
+
+
#]=======================================================================]
get_property(_fsPkgTypeIsSet GLOBAL PROPERTY FeatureSummary_PKG_TYPES SET)
@@ -196,7 +206,7 @@ endfunction()
[VAR <variable_name>]
[INCLUDE_QUIET_PACKAGES]
[FATAL_ON_MISSING_REQUIRED_PACKAGES]
- [DESCRIPTION "<description>"]
+ [DESCRIPTION "<description>" | DEFAULT_DESCRIPTION]
[QUIET_ON_EMPTY]
WHAT (ALL
| PACKAGES_FOUND | PACKAGES_NOT_FOUND
@@ -247,7 +257,10 @@ endfunction()
information is "printed" into the specified variable. If ``FILENAME`` is
not used, the information is printed to the terminal. Using the
``DESCRIPTION`` option a description or headline can be set which will be
- printed above the actual content.
+ printed above the actual content. If only one type of
+ package was requested, no title is printed, unless it is explicitly set using
+ either ``DESCRIPTION`` to use a custom string, or ``DEFAULT_DESCRIPTION`` to
+ use a default title for the requested type.
If ``INCLUDE_QUIET_PACKAGES`` is given, packages which have been searched with
``find_package(... QUIET)`` will also be listed. By default they are skipped.
If ``FATAL_ON_MISSING_REQUIRED_PACKAGES`` is given, CMake will abort if a
@@ -306,8 +319,14 @@ endfunction()
function(FEATURE_SUMMARY)
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
- set(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES QUIET_ON_EMPTY)
- set(oneValueArgs FILENAME VAR DESCRIPTION)
+ set(options APPEND
+ INCLUDE_QUIET_PACKAGES
+ FATAL_ON_MISSING_REQUIRED_PACKAGES
+ QUIET_ON_EMPTY
+ DEFAULT_DESCRIPTION)
+ set(oneValueArgs FILENAME
+ VAR
+ DESCRIPTION)
set(multiValueArgs WHAT)
CMAKE_PARSE_ARGUMENTS(_FS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
@@ -320,6 +339,11 @@ function(FEATURE_SUMMARY)
message(FATAL_ERROR "The call to FEATURE_SUMMARY() doesn't set the required WHAT argument.")
endif()
+ if(_FS_DEFAULT_DESCRIPTION AND DEFINED _FS_DESCRIPTION)
+ message(WARNING "DEFAULT_DESCRIPTION option discarded since DESCRIPTION is set.")
+ set(_FS_DEFAULT_DESCRIPTION 0)
+ endif()
+
set(validWhatParts "ENABLED_FEATURES"
"DISABLED_FEATURES"
"PACKAGES_FOUND"
@@ -332,11 +356,29 @@ function(FEATURE_SUMMARY)
"${_fsPkgType}_PACKAGES_NOT_FOUND")
endforeach()
+ set(title_ENABLED_FEATURES "The following features have been enabled:")
+ set(title_DISABLED_FEATURES "The following features have been disabled:")
+ set(title_PACKAGES_FOUND "The following packages have been found:")
+ set(title_PACKAGES_NOT_FOUND "The following packages have not been found:")
+ foreach(_fsPkgType ${_fsPkgTypes})
+ set(_fsPkgTypeDescription "${_fsPkgType} packages")
+ get_property(_fsPkgTypeDescriptionIsSet GLOBAL PROPERTY FeatureSummary_${_fsPkgType}_DESCRIPTION SET)
+ if(_fsPkgTypeDescriptionIsSet)
+ get_property(_fsPkgTypeDescription GLOBAL PROPERTY FeatureSummary_${_fsPkgType}_DESCRIPTION )
+ endif()
+ set(title_${_fsPkgType}_PACKAGES_FOUND "The following ${_fsPkgTypeDescription} have been found:")
+ set(title_${_fsPkgType}_PACKAGES_NOT_FOUND "The following ${_fsPkgTypeDescription} have not been found:")
+ endforeach()
+
list(FIND validWhatParts "${_FS_WHAT}" indexInList)
if(NOT "${indexInList}" STREQUAL "-1")
_FS_GET_FEATURE_SUMMARY( ${_FS_WHAT} _featureSummary ${_FS_INCLUDE_QUIET_PACKAGES} )
if(_featureSummary OR NOT _FS_QUIET_ON_EMPTY)
- set(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n")
+ if(_FS_DEFAULT_DESCRIPTION)
+ set(_fullText "${title_${_FS_WHAT}}\n${_featureSummary}\n")
+ else()
+ set(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n")
+ endif()
endif()
if(_featureSummary)
@@ -375,15 +417,6 @@ function(FEATURE_SUMMARY)
endforeach()
endif()
- set(title_ENABLED_FEATURES "The following features have been enabled:")
- set(title_DISABLED_FEATURES "The following features have been disabled:")
- set(title_PACKAGES_FOUND "The following packages have been found:")
- set(title_PACKAGES_NOT_FOUND "The following packages have not been found:")
- foreach(_fsPkgType ${_fsPkgTypes})
- set(title_${_fsPkgType}_PACKAGES_FOUND "The following ${_fsPkgType} packages have been found:")
- set(title_${_fsPkgType}_PACKAGES_NOT_FOUND "The following ${_fsPkgType} packages have not been found:")
- endforeach()
-
set(_fullText "${_FS_DESCRIPTION}")
foreach(part ${allWhatParts})
set(_tmp)
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index 6540171..c4b4535 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -70,64 +70,10 @@
# Deeper integration with CTest
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
-# If you would like each Google test to show up in CTest as a test you
-# may use the following macro::
-#
-# GTEST_ADD_TESTS(executable extra_args files...)
-#
-# ``executable``
-# the path to the test executable
-# ``extra_args``
-# a list of extra arguments to be passed to executable enclosed in
-# quotes (or ``""`` for none)
-# ``files...``
-# a list of source files to search for tests and test fixtures. Or
-# ``AUTO`` to find them from executable target
-#
-# However, note that this macro will slow down your tests by running
-# an executable for each test and test fixture.
-#
-# Example usage::
-#
-# set(FooTestArgs --foo 1 --bar 2)
-# add_executable(FooTest FooUnitTest.cc)
-# GTEST_ADD_TESTS(FooTest "${FooTestArgs}" AUTO)
-
-#
-# Thanks to Daniel Blezek <blezek@gmail.com> for the GTEST_ADD_TESTS code
-
-function(GTEST_ADD_TESTS executable extra_args)
- if(NOT ARGN)
- message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS")
- endif()
- if(ARGN STREQUAL "AUTO")
- # obtain sources used for building that executable
- get_property(ARGN TARGET ${executable} PROPERTY SOURCES)
- endif()
- set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+) *, *([A-Za-z_0-9]+) *\\).*")
- set(gtest_test_type_regex "(TYPED_TEST|TEST_?[FP]?)")
- foreach(source ${ARGN})
- set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${source})
- file(READ "${source}" contents)
- string(REGEX MATCHALL "${gtest_test_type_regex} *\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
- foreach(hit ${found_tests})
- string(REGEX MATCH "${gtest_test_type_regex}" test_type ${hit})
+# See :module:`GoogleTest` for information on the :command:`gtest_add_tests`
+# command.
- # Parameterized tests have a different signature for the filter
- if("x${test_type}" STREQUAL "xTEST_P")
- string(REGEX REPLACE ${gtest_case_name_regex} "*/\\1.\\2/*" test_name ${hit})
- elseif("x${test_type}" STREQUAL "xTEST_F" OR "x${test_type}" STREQUAL "xTEST")
- string(REGEX REPLACE ${gtest_case_name_regex} "\\1.\\2" test_name ${hit})
- elseif("x${test_type}" STREQUAL "xTYPED_TEST")
- string(REGEX REPLACE ${gtest_case_name_regex} "\\1/*.\\2" test_name ${hit})
- else()
- message(WARNING "Could not parse GTest ${hit} for adding to CTest.")
- continue()
- endif()
- add_test(NAME ${test_name} COMMAND ${executable} --gtest_filter=${test_name} ${extra_args})
- endforeach()
- endforeach()
-endfunction()
+include(${CMAKE_CURRENT_LIST_DIR}/GoogleTest.cmake)
function(_gtest_append_debugs _endvar _library)
if(${_library} AND ${_library}_DEBUG)
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 3ffd5a7..102ed42 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -20,6 +20,9 @@
# imported .proto files.
# ``Protobuf_DEBUG``
# Show debug messages.
+# ``Protobuf_USE_STATIC_LIBS``
+# Set to ON to force the use of the static libraries.
+# Default is OFF.
#
# Defines the following variables:
#
@@ -218,6 +221,14 @@ function(PROTOBUF_GENERATE_PYTHON SRCS)
set(${SRCS} ${${SRCS}} PARENT_SCOPE)
endfunction()
+
+if(Protobuf_DEBUG)
+ # Output some of their choices
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Protobuf_USE_STATIC_LIBS = ${Protobuf_USE_STATIC_LIBS}")
+endif()
+
+
# Backwards compatibility
# Define camel case versions of input variables
foreach(UPPER
@@ -245,6 +256,17 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_PROTOBUF_ARCH_DIR x64/)
endif()
+
+# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
+if( Protobuf_USE_STATIC_LIBS )
+ set( _protobuf_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ if(WIN32)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ else()
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
+ endif()
+endif()
+
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
# Internal function: search for normal library as well as a debug one
@@ -399,6 +421,11 @@ if(Protobuf_FOUND)
set(Protobuf_INCLUDE_DIRS ${Protobuf_INCLUDE_DIR})
endif()
+# Restore the original find library ordering
+if( Protobuf_USE_STATIC_LIBS )
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${_protobuf_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+endif()
+
# Backwards compatibility
# Define upper case versions of output variables
foreach(Camel
diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake
new file mode 100644
index 0000000..91a3a25
--- /dev/null
+++ b/Modules/GoogleTest.cmake
@@ -0,0 +1,73 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+GoogleTest
+----------
+
+This module defines functions to help use the Google Test infrastructure.
+
+.. command:: gtest_add_tests
+
+ Automatically add tests with CTest by scanning source code for Google test
+ macros.
+
+ ::
+
+ gtest_add_tests(<exe> <args> <files>...)
+
+ ``<exe>``
+ The path to the test executable.
+ ``<args>``
+ A ;-list of extra arguments to be passed to executable. The entire
+ list must be passed as a single argument. Enclose it in quotes,
+ or pass ``""`` for no arguments.
+ ``<files>...``
+ A list of source files to search for tests and test fixtures.
+ Alternatively, use ``AUTO`` to specify that ``<exe>`` is the name
+ of a CMake executable target whose sources should be scanned.
+
+Example
+^^^^^^^
+
+.. code-block:: cmake
+
+ include(GoogleTest)
+ set(FooTestArgs --foo 1 --bar 2)
+ add_executable(FooTest FooUnitTest.cc)
+ gtest_add_tests(FooTest "${FooTestArgs}" AUTO)
+
+#]=======================================================================]
+
+function(gtest_add_tests executable extra_args)
+ if(NOT ARGN)
+ message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS")
+ endif()
+ if(ARGN STREQUAL "AUTO")
+ # obtain sources used for building that executable
+ get_property(ARGN TARGET ${executable} PROPERTY SOURCES)
+ endif()
+ set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+) *, *([A-Za-z_0-9]+) *\\).*")
+ set(gtest_test_type_regex "(TYPED_TEST|TEST_?[FP]?)")
+ foreach(source ${ARGN})
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${source})
+ file(READ "${source}" contents)
+ string(REGEX MATCHALL "${gtest_test_type_regex} *\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
+ foreach(hit ${found_tests})
+ string(REGEX MATCH "${gtest_test_type_regex}" test_type ${hit})
+
+ # Parameterized tests have a different signature for the filter
+ if("x${test_type}" STREQUAL "xTEST_P")
+ string(REGEX REPLACE ${gtest_case_name_regex} "*/\\1.\\2/*" test_name ${hit})
+ elseif("x${test_type}" STREQUAL "xTEST_F" OR "x${test_type}" STREQUAL "xTEST")
+ string(REGEX REPLACE ${gtest_case_name_regex} "\\1.\\2" test_name ${hit})
+ elseif("x${test_type}" STREQUAL "xTYPED_TEST")
+ string(REGEX REPLACE ${gtest_case_name_regex} "\\1/*.\\2" test_name ${hit})
+ else()
+ message(WARNING "Could not parse GTest ${hit} for adding to CTest.")
+ continue()
+ endif()
+ add_test(NAME ${test_name} COMMAND ${executable} --gtest_filter=${test_name} ${extra_args})
+ endforeach()
+ endforeach()
+endfunction()