summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CheckCSourceCompiles.cmake7
-rw-r--r--Modules/CheckCSourceRuns.cmake7
-rw-r--r--Modules/CheckCXXSourceCompiles.cmake7
-rw-r--r--Modules/CheckCXXSourceRuns.cmake7
-rw-r--r--Modules/CheckFortranFunctionExists.cmake7
-rw-r--r--Modules/CheckFunctionExists.cmake7
-rw-r--r--Modules/CheckLibraryExists.cmake7
-rw-r--r--Modules/CheckPrototypeDefinition.cmake7
-rw-r--r--Modules/CheckSymbolExists.cmake7
-rw-r--r--Modules/CheckTypeSize.cmake5
-rw-r--r--Modules/CheckVariableExists.cmake7
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake67
-rw-r--r--Modules/GenerateExportHeader.cmake6
-rw-r--r--Source/CMakeLists.txt2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmCoreTryCompile.cxx108
-rw-r--r--Source/cmExportFileGenerator.cxx46
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx114
-rw-r--r--Source/cmExportTryCompileFileGenerator.h55
-rw-r--r--Source/cmGeneratorExpression.cxx10
-rw-r--r--Source/cmGeneratorExpression.h9
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx10
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.h4
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx101
-rw-r--r--Source/cmGeneratorExpressionEvaluator.h3
-rw-r--r--Source/cmGlobalGenerator.cxx10
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx1
-rw-r--r--Source/cmLocalGenerator.h10
-rw-r--r--Source/cmQtAutomoc.cxx27
-rw-r--r--Source/cmQtAutomoc.h1
-rw-r--r--Source/cmTarget.cxx132
-rw-r--r--Source/cmTryCompileCommand.h8
-rw-r--r--Tests/CMakeLists.txt44
-rw-r--r--Tests/ExportImport/Import/CMakeLists.txt2
-rw-r--r--Tests/ExportImport/Import/try_compile/CMakeLists.txt21
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt10
-rw-r--r--Tests/FindPackageTest/FindSomePackage.cmake6
-rw-r--r--Tests/FindPackageTest/FindUpperCasePackage.cmake6
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt31
-rw-r--r--Tests/GeneratorExpression/check-part2.cmake8
-rw-r--r--Tests/GeneratorExpression/empty.cpp2
-rw-r--r--Tests/Module/ExternalData/CMakeLists.txt5
-rw-r--r--Tests/Module/ExternalData/Data Space.dat.md51
-rw-r--r--Tests/Module/ExternalData/Data1Check.cmake6
-rw-r--r--Tests/QtAutomoc/CMakeLists.txt6
-rw-r--r--Tests/QtAutomoc/empty.cpp1
-rw-r--r--Tests/QtAutomoc/empty.h9
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/FPHSA/BadFoundVar-result.txt1
-rw-r--r--Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt7
-rw-r--r--Tests/RunCMake/FPHSA/BadFoundVar.cmake3
-rw-r--r--Tests/RunCMake/FPHSA/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/FPHSA/FindBadFoundVar.cmake6
-rw-r--r--Tests/RunCMake/FPHSA/RunCMakeTest.cmake3
-rwxr-xr-xbootstrap1
55 files changed, 746 insertions, 238 deletions
diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake
index b457754..86a4565 100644
--- a/Modules/CheckCSourceCompiles.cmake
+++ b/Modules/CheckCSourceCompiles.cmake
@@ -24,7 +24,6 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
@@ -43,10 +42,8 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
if(CMAKE_REQUIRED_LIBRARIES)
- # this one translates potentially used imported library targets to their files on disk
- CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
- "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
else()
set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
endif()
@@ -64,8 +61,8 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
- "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
"${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
OUTPUT_VARIABLE OUTPUT)
diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake
index bc64acd..e3a091f 100644
--- a/Modules/CheckCSourceRuns.cmake
+++ b/Modules/CheckCSourceRuns.cmake
@@ -24,7 +24,6 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
@@ -32,10 +31,8 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
if(CMAKE_REQUIRED_LIBRARIES)
- # this one translates potentially used imported library targets to their files on disk
- CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
- "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
else()
set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
endif()
@@ -53,9 +50,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
-DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
- "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
"${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
COMPILE_OUTPUT_VARIABLE OUTPUT)
# if it did not compile make the return value fail code of 1
diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake
index c0be1f7..734c083 100644
--- a/Modules/CheckCXXSourceCompiles.cmake
+++ b/Modules/CheckCXXSourceCompiles.cmake
@@ -24,7 +24,6 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
@@ -44,10 +43,8 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
if(CMAKE_REQUIRED_LIBRARIES)
- # this one translates potentially used imported library targets to their files on disk
- CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
set(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
- "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
else()
set(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES)
endif()
@@ -65,8 +62,8 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
- "${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}"
"${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}"
OUTPUT_VARIABLE OUTPUT)
diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake
index 47ab161..9e401f1 100644
--- a/Modules/CheckCXXSourceRuns.cmake
+++ b/Modules/CheckCXXSourceRuns.cmake
@@ -24,7 +24,6 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
@@ -32,10 +31,8 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
if(CMAKE_REQUIRED_LIBRARIES)
- # this one translates potentially used imported library targets to their files on disk
- CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
set(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
- "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
else()
set(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES)
endif()
@@ -53,9 +50,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
-DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
- "${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}"
"${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}"
COMPILE_OUTPUT_VARIABLE OUTPUT)
diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake
index 4b9f9b7..45dd7be 100644
--- a/Modules/CheckFortranFunctionExists.cmake
+++ b/Modules/CheckFortranFunctionExists.cmake
@@ -22,17 +22,14 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE)
if(NOT DEFINED ${VARIABLE})
message(STATUS "Looking for Fortran ${FUNCTION}")
if(CMAKE_REQUIRED_LIBRARIES)
- # this one translates potentially used imported library targets to their files on disk
- cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
- "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
else()
set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES)
endif()
@@ -48,7 +45,7 @@ macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE)
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
- CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
+ ${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}
OUTPUT_VARIABLE OUTPUT
)
# message(STATUS "${OUTPUT}")
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake
index 3f952e0..7aa1748 100644
--- a/Modules/CheckFunctionExists.cmake
+++ b/Modules/CheckFunctionExists.cmake
@@ -27,7 +27,6 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
@@ -36,10 +35,8 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
"-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
message(STATUS "Looking for ${FUNCTION}")
if(CMAKE_REQUIRED_LIBRARIES)
- # this one translates potentially used imported library targets to their files on disk
- CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
- "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
else()
set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES)
endif()
@@ -53,8 +50,8 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/CheckFunctionExists.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
- "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
"${CHECK_FUNCTION_EXISTS_ADD_INCLUDES}"
OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE})
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake
index 697f8a4..fb7d0ec 100644
--- a/Modules/CheckLibraryExists.cmake
+++ b/Modules/CheckLibraryExists.cmake
@@ -26,7 +26,6 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
@@ -36,19 +35,17 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}")
set(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY})
if(CMAKE_REQUIRED_LIBRARIES)
- # this one translates potentially used imported library targets to their files on disk
- CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
set(CHECK_LIBRARY_EXISTS_LIBRARIES
- ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES})
+ ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${CMAKE_REQUIRED_LIBRARIES})
endif()
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/CheckFunctionExists.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ LINK_LIBRARIES ${CHECK_LIBRARY_EXISTS_LIBRARIES}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_LIBRARY_EXISTS_DEFINITION}
-DLINK_DIRECTORIES:STRING=${LOCATION}
- "-DLINK_LIBRARIES:STRING=${CHECK_LIBRARY_EXISTS_LIBRARIES}"
OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE})
diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake
index 74b94b8..2342b3c 100644
--- a/Modules/CheckPrototypeDefinition.cmake
+++ b/Modules/CheckPrototypeDefinition.cmake
@@ -34,7 +34,6 @@
# License text for the above reference.)
#
-include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
@@ -46,10 +45,8 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB
set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS})
if (CMAKE_REQUIRED_LIBRARIES)
- # this one translates potentially used imported library targets to their files on disk
- cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
set(CHECK_PROTOTYPE_DEFINITION_LIBS
- "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
else()
set(CHECK_PROTOTYPE_DEFINITION_LIBS)
endif()
@@ -78,8 +75,8 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_PROTOTYPE_DEFINITION_LIBS}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CHECK_PROTOTYPE_DEFINITION_FLAGS}
- "${CHECK_PROTOTYPE_DEFINITION_LIBS}"
"${CMAKE_SYMBOL_EXISTS_INCLUDES}"
OUTPUT_VARIABLE OUTPUT)
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index 5a8597f..0969bc5 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -35,7 +35,6 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
@@ -47,10 +46,8 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
set(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS})
if(CMAKE_REQUIRED_LIBRARIES)
- # this one translates potentially used imported library targets to their files on disk
- CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
set(CHECK_SYMBOL_EXISTS_LIBS
- "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
else()
set(CHECK_SYMBOL_EXISTS_LIBS)
endif()
@@ -75,9 +72,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
${CMAKE_BINARY_DIR}
"${SOURCEFILE}"
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_SYMBOL_EXISTS_LIBS}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_SYMBOL_EXISTS_FLAGS}
- "${CHECK_SYMBOL_EXISTS_LIBS}"
"${CMAKE_SYMBOL_EXISTS_INCLUDES}"
OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE})
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
index 7285b8a..2d0eab5 100644
--- a/Modules/CheckTypeSize.cmake
+++ b/Modules/CheckTypeSize.cmake
@@ -52,7 +52,6 @@
# License text for the above reference.)
include(CheckIncludeFile)
-include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
cmake_policy(PUSH)
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
@@ -83,18 +82,16 @@ function(__check_type_size_impl type var map builtin)
# Perform the check.
- # this one translates potentially used imported library targets to their files on disk
- cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.c)
set(bin ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.bin)
configure_file(${__check_type_size_dir}/CheckTypeSize.c.in ${src} @ONLY)
try_compile(HAVE_${var} ${CMAKE_BINARY_DIR} ${src}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
CMAKE_FLAGS
"-DCOMPILE_DEFINITIONS:STRING=${CMAKE_REQUIRED_FLAGS}"
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
- "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}"
OUTPUT_VARIABLE output
COPY_FILE ${bin}
)
diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake
index f9155a0..a21e65f 100644
--- a/Modules/CheckVariableExists.cmake
+++ b/Modules/CheckVariableExists.cmake
@@ -26,7 +26,6 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
@@ -35,10 +34,8 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
"-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}")
message(STATUS "Looking for ${VAR}")
if(CMAKE_REQUIRED_LIBRARIES)
- # this one translates potentially used imported library targets to their files on disk
- CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES
- "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
else()
set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES)
endif()
@@ -46,8 +43,8 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/CheckVariableExists.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_VARIABLE_EXISTS_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_VARIABLE_DEFINITIONS}
- "${CHECK_VARIABLE_EXISTS_ADD_LIBRARIES}"
OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE})
set(${VARIABLE} 1 CACHE INTERNAL "Have variable ${VAR}")
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index e89e9a9..5f92a86 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -2,7 +2,7 @@
#
# This function is intended to be used in FindXXX.cmake modules files.
# It handles the REQUIRED, QUIET and version-related arguments to find_package().
-# It also sets the <UPPERCASED_NAME>_FOUND variable.
+# It also sets the <packagename>_FOUND variable.
# The package is considered found if all variables <var1>... listed contain
# valid results, e.g. valid filepaths.
#
@@ -18,14 +18,22 @@
# for the failure case. This is not recommended.
#
# The second mode is more powerful and also supports version checking:
-# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [REQUIRED_VARS <var1>...<varN>]
+# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [FOUND_VAR <resultVar>]
+# [REQUIRED_VARS <var1>...<varN>]
# [VERSION_VAR <versionvar>]
# [HANDLE_COMPONENTS]
# [CONFIG_MODE]
# [FAIL_MESSAGE "Custom failure message"] )
#
-# As above, if <var1> through <varN> are all valid, <UPPERCASED_NAME>_FOUND
-# will be set to TRUE.
+# In this mode, the name of the result-variable can be set either to either
+# <UPPERCASED_NAME>_FOUND or <OriginalCase_Name>_FOUND using the FOUND_VAR option.
+# Other names for the result-variable are not allowed.
+# So for a Find-module named FindFooBar.cmake, the two possible names are
+# FooBar_FOUND and FOOBAR_FOUND. It is recommended to use the original case version.
+# If the FOUND_VAR option is not used, the default is <UPPERCASED_NAME>_FOUND.
+#
+# As in the simple mode, if <var1> through <varN> are all valid,
+# <packagename>_FOUND will be set to TRUE.
# After REQUIRED_VARS the variables which are required for this package are listed.
# Following VERSION_VAR the name of the variable can be specified which holds
# the version of the package which has been found. If this is done, this version
@@ -35,7 +43,7 @@
# which has been actually found, both if the version is ok or not.
# If the package supports components, use the HANDLE_COMPONENTS option to enable
# handling them. In this case, find_package_handle_standard_args() will report
-# which components have been found and which are missing, and the <NAME>_FOUND
+# which components have been found and which are missing, and the <packagename>_FOUND
# variable will be set to FALSE if any of the required components (i.e. not the
# ones listed after OPTIONAL_COMPONENTS) are missing.
# Use the option CONFIG_MODE if your FindXXX.cmake module is a wrapper for
@@ -47,7 +55,7 @@
#
# Example for mode 1:
#
-# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
+# find_package_handle_standard_args(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
#
# LibXml2 is considered to be found, if both LIBXML2_LIBRARY and
# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
@@ -58,20 +66,23 @@
#
# Example for mode 2:
#
-# FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE
-# VERSION_VAR BISON_VERSION)
-# In this case, BISON is considered to be found if the variable(s) listed
-# after REQUIRED_VAR are all valid, i.e. BISON_EXECUTABLE in this case.
-# Also the version of BISON will be checked by using the version contained
-# in BISON_VERSION.
+# find_package_handle_standard_args(LibXslt FOUND_VAR LibXslt_FOUND
+# REQUIRED_VARS LibXslt_LIBRARIES LibXslt_INCLUDE_DIRS
+# VERSION_VAR LibXslt_VERSION_STRING)
+# In this case, LibXslt is considered to be found if the variable(s) listed
+# after REQUIRED_VAR are all valid, i.e. LibXslt_LIBRARIES and LibXslt_INCLUDE_DIRS
+# in this case. The result will then be stored in LibXslt_FOUND .
+# Also the version of LibXslt will be checked by using the version contained
+# in LibXslt_VERSION_STRING.
# Since no FAIL_MESSAGE is given, the default messages will be printed.
#
# Another example for mode 2:
#
# find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4)
-# FIND_PACKAGE_HANDLE_STANDARD_ARGS(Automoc4 CONFIG_MODE)
+# find_package_handle_standard_args(Automoc4 CONFIG_MODE)
# In this case, FindAutmoc4.cmake wraps a call to find_package(Automoc4 NO_MODULE)
# and adds an additional search directory for automoc4.
+# Here the result will be stored in AUTOMOC4_FOUND.
# The following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper
# success/error message.
@@ -137,8 +148,8 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
# set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in
# new extended or in the "old" mode:
- set(options CONFIG_MODE HANDLE_COMPONENTS)
- set(oneValueArgs FAIL_MESSAGE VERSION_VAR)
+ set(options CONFIG_MODE HANDLE_COMPONENTS)
+ set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR)
set(multiValueArgs REQUIRED_VARS)
set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} )
list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX)
@@ -183,22 +194,32 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
string(TOUPPER ${_NAME} _NAME_UPPER)
string(TOLOWER ${_NAME} _NAME_LOWER)
+ if(FPHSA_FOUND_VAR)
+ if("${FPHSA_FOUND_VAR}" MATCHES "^${_NAME}_FOUND$" OR "${FPHSA_FOUND_VAR}" MATCHES "^${_NAME_UPPER}_FOUND$")
+ set(_FOUND_VAR ${FPHSA_FOUND_VAR})
+ else()
+ message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.")
+ endif()
+ else()
+ set(_FOUND_VAR ${_NAME_UPPER}_FOUND)
+ endif()
+
# collect all variables which were not found, so they can be printed, so the
# user knows better what went wrong (#6375)
set(MISSING_VARS "")
set(DETAILS "")
# check if all passed variables are valid
- unset(${_NAME_UPPER}_FOUND)
+ unset(${_FOUND_VAR})
foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
if(NOT ${_CURRENT_VAR})
- set(${_NAME_UPPER}_FOUND FALSE)
+ set(${_FOUND_VAR} FALSE)
set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}")
else()
set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
endif()
endforeach()
- if(NOT "${${_NAME_UPPER}_FOUND}" STREQUAL "FALSE")
- set(${_NAME_UPPER}_FOUND TRUE)
+ if(NOT "${${_FOUND_VAR}}" STREQUAL "FALSE")
+ set(${_FOUND_VAR} TRUE)
endif()
# component handling
@@ -222,7 +243,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}")
if(${_NAME}_FIND_REQUIRED_${comp})
- set(${_NAME_UPPER}_FOUND FALSE)
+ set(${_FOUND_VAR} FALSE)
set(MISSING_VARS "${MISSING_VARS} ${comp}")
endif()
@@ -276,12 +297,12 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
if(VERSION_OK)
set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]")
else()
- set(${_NAME_UPPER}_FOUND FALSE)
+ set(${_FOUND_VAR} FALSE)
endif()
# print the result:
- if (${_NAME_UPPER}_FOUND)
+ if (${_FOUND_VAR})
FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}")
else ()
@@ -297,6 +318,6 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
endif ()
- set(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE)
+ set(${_FOUND_VAR} ${${_FOUND_VAR}} PARENT_SCOPE)
endfunction()
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index ce23d5d..892ebc6 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -47,7 +47,7 @@
# ...
# };
#
-# The CMake fragment will generate a file in the ${CMAKE_CURRENT_BUILD_DIR}
+# The CMake fragment will generate a file in the ${CMAKE_CURRENT_BINARY_DIR}
# called somelib_export.h containing the macros SOMELIB_EXPORT, SOMELIB_NO_EXPORT,
# SOMELIB_DEPRECATED, SOMELIB_DEPRECATED_EXPORT and SOMELIB_DEPRECATED_NO_EXPORT.
# The resulting file should be installed with other headers in the library.
@@ -156,16 +156,12 @@ macro(_test_compiler_hidden_visibility)
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2")
set(GCC_TOO_OLD TRUE)
- message(WARNING "GCC version older than 4.2")
elseif(CMAKE_COMPILER_IS_GNUC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.2")
set(GCC_TOO_OLD TRUE)
- message(WARNING "GCC version older than 4.2")
elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0")
set(_INTEL_TOO_OLD TRUE)
- message(WARNING "Intel compiler older than 12.0")
endif()
-
# Exclude XL here because it misinterprets -fvisibility=hidden even though
# the check_cxx_compiler_flag passes
# http://www.cdash.org/CDash/testDetails.php?test=109109951&build=1419259
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 7808f23..ab62d2b 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -176,6 +176,8 @@ set(SRCS
cmExportFileGenerator.cxx
cmExportInstallFileGenerator.h
cmExportInstallFileGenerator.cxx
+ cmExportTryCompileFileGenerator.h
+ cmExportTryCompileFileGenerator.cxx
cmExportSet.h
cmExportSet.cxx
cmExportSetMap.h
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 073a09a..33dd6a2 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,5 +2,5 @@
set(CMake_VERSION_MAJOR 2)
set(CMake_VERSION_MINOR 8)
set(CMake_VERSION_PATCH 10)
-set(CMake_VERSION_TWEAK 20130224)
+set(CMake_VERSION_TWEAK 20130304)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 1ae7035..387f6ed 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -13,8 +13,11 @@
#include "cmake.h"
#include "cmCacheManager.h"
#include "cmGlobalGenerator.h"
+#include "cmExportTryCompileFileGenerator.h"
#include <cmsys/Directory.hxx>
+#include <assert.h>
+
int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
{
this->BinaryDirectory = argv[1].c_str();
@@ -39,7 +42,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
// is not used, so it matches regular command line parsing which has
// the program name as arg 0
for (; i < argv.size() && argv[i] != "COMPILE_DEFINITIONS" &&
- argv[i] != "OUTPUT_VARIABLE";
+ argv[i] != "OUTPUT_VARIABLE" &&
+ argv[i] != "LINK_LIBRARIES";
++i)
{
extraArgs++;
@@ -75,7 +79,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
{
extraArgs++;
for (i = i + 1; i < argv.size() && argv[i] != "CMAKE_FLAGS" &&
- argv[i] != "OUTPUT_VARIABLE";
+ argv[i] != "OUTPUT_VARIABLE" &&
+ argv[i] != "LINK_LIBRARIES";
++i)
{
extraArgs++;
@@ -85,6 +90,61 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
}
}
+ std::vector<cmTarget*> targets;
+ std::string libsToLink = " ";
+ bool useOldLinkLibs = true;
+ for (i = 3; i < argv.size(); ++i)
+ {
+ if (argv[i] == "LINK_LIBRARIES")
+ {
+ if ( argv.size() <= (i+1) )
+ {
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+ "LINK_LIBRARIES specified but there is no content");
+ return -1;
+ }
+ extraArgs++;
+ ++i;
+ useOldLinkLibs = false;
+ for ( ; i < argv.size() && argv[i] != "CMAKE_FLAGS"
+ && argv[i] != "COMPILE_DEFINITIONS" && argv[i] != "OUTPUT_VARIABLE";
+ ++i)
+ {
+ extraArgs++;
+ libsToLink += argv[i] + " ";
+ cmTarget *tgt = this->Makefile->FindTargetToUse(argv[i].c_str());
+ if (!tgt)
+ {
+ continue;
+ }
+ switch(tgt->GetType())
+ {
+ case cmTarget::SHARED_LIBRARY:
+ case cmTarget::STATIC_LIBRARY:
+ case cmTarget::UNKNOWN_LIBRARY:
+ break;
+ case cmTarget::EXECUTABLE:
+ if (tgt->IsExecutableWithExports())
+ {
+ break;
+ }
+ default:
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+ "Only libraries may be used as try_compile IMPORTED "
+ "LINK_LIBRARIES. Got " + std::string(tgt->GetName()) + " of "
+ "type " + tgt->GetTargetTypeName(tgt->GetType()) + ".");
+ return -1;
+ }
+ if (!tgt->IsImported())
+ {
+ continue;
+ }
+ targets.push_back(tgt);
+ }
+ break;
+ }
+ }
+
// look for COPY_FILE
std::string copyFile;
for (i = 3; i < argv.size(); ++i)
@@ -247,6 +307,32 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
fprintf(fout, ")\n");
}
+ /* Use a random file name to avoid rapid creation and deletion
+ of the same executable name (some filesystems fail on that). */
+ sprintf(targetNameBuf, "cmTryCompileExec%u",
+ cmSystemTools::RandomSeed());
+ targetName = targetNameBuf;
+
+ if (!targets.empty())
+ {
+ std::string fname = "/" + std::string(targetName) + "Targets.cmake";
+ cmExportTryCompileFileGenerator tcfg;
+ tcfg.SetExportFile((this->BinaryDirectory + fname).c_str());
+ tcfg.SetExports(targets);
+ tcfg.SetConfig(this->Makefile->GetDefinition(
+ "CMAKE_TRY_COMPILE_CONFIGURATION"));
+
+ if(!tcfg.GenerateImportFile())
+ {
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+ "could not write export file.");
+ return -1;
+ }
+ fprintf(fout,
+ "\ninclude(\"${CMAKE_CURRENT_LIST_DIR}/%s\")\n\n",
+ fname.c_str());
+ }
+
/* for the TRY_COMPILEs we want to be able to specify the architecture.
So the user can set CMAKE_OSX_ARCHITECTURE to i386;ppc and then set
CMAKE_TRY_COMPILE_OSX_ARCHITECTURE first to i386 and then to ppc to
@@ -286,18 +372,22 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
fprintf(fout, "SET(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n");
}
- /* Use a random file name to avoid rapid creation and deletion
- of the same executable name (some filesystems fail on that). */
- sprintf(targetNameBuf, "cmTryCompileExec%u",
- cmSystemTools::RandomSeed());
- targetName = targetNameBuf;
-
/* Put the executable at a known location (for COPY_FILE). */
fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
this->BinaryDirectory.c_str());
/* Create the actual executable. */
fprintf(fout, "ADD_EXECUTABLE(%s \"%s\")\n", targetName, source.c_str());
- fprintf(fout, "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName);
+ if (useOldLinkLibs)
+ {
+ fprintf(fout,
+ "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName);
+ }
+ else
+ {
+ fprintf(fout, "TARGET_LINK_LIBRARIES(%s %s)\n",
+ targetName,
+ libsToLink.c_str());
+ }
fclose(fout);
projectName = "CMAKE_TRY_COMPILE";
// if the source is not in CMakeTmp
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index ef4ea38..7fd0380 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -679,6 +679,9 @@ cmExportFileGenerator
case cmTarget::MODULE_LIBRARY:
os << "add_library(" << targetName << " MODULE IMPORTED)\n";
break;
+ case cmTarget::UNKNOWN_LIBRARY:
+ os << "add_library(" << targetName << " UNKNOWN IMPORTED)\n";
+ break;
default: // should never happen
break;
}
@@ -754,29 +757,46 @@ void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os,
{
if (missingTargets.empty())
{
+ os << "# This file does not depend on other imported targets which have\n"
+ "# been exported from the same project but in a separate "
+ "export set.\n\n";
return;
}
os << "# Make sure the targets which have been exported in some other \n"
- "# export set exist.\n";
+ "# export set exist.\n"
+ "unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n"
+ "foreach(_target ";
std::set<std::string> emitted;
for(unsigned int i=0; i<missingTargets.size(); ++i)
{
if (emitted.insert(missingTargets[i]).second)
{
- os << "if(NOT TARGET \"" << missingTargets[i] << "\" )\n"
- << " if(CMAKE_FIND_PACKAGE_NAME)\n"
- << " set( ${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)\n"
- << " set( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "
- << "\"Required imported target \\\"" << missingTargets[i]
- << "\\\" not found ! \")\n"
- << " else()\n"
- << " message(FATAL_ERROR \"Required imported target \\\""
- << missingTargets[i] << "\\\" not found ! \")\n"
- << " endif()\n"
- << "endif()\n";
+ os << "\"" << missingTargets[i] << "\" ";
}
}
- os << "\n";
+ os << ")\n"
+ " if(NOT TARGET \"${_target}\" )\n"
+ " set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets \""
+ "${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets} ${_target}\")"
+ "\n"
+ " endif()\n"
+ "endforeach()\n"
+ "\n"
+ "if(DEFINED ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n"
+ " if(CMAKE_FIND_PACKAGE_NAME)\n"
+ " set( ${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)\n"
+ " set( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "
+ "\"The following imported targets are "
+ "referenced, but are missing: "
+ "${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets}\")\n"
+ " else()\n"
+ " message(FATAL_ERROR \"The following imported targets are "
+ "referenced, but are missing: "
+ "${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets}\")\n"
+ " endif()\n"
+ "endif()\n"
+ "unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n"
+ "\n";
}
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
new file mode 100644
index 0000000..75f2651
--- /dev/null
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -0,0 +1,114 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2013 Stephen Kelly <steveire@gmail.com>
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#include "cmExportTryCompileFileGenerator.h"
+
+#include "cmGeneratedFileStream.h"
+#include "cmGeneratorExpressionDAGChecker.h"
+
+//----------------------------------------------------------------------------
+bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os)
+{
+ std::set<cmTarget*> emitted;
+ std::set<cmTarget*> emittedDeps;
+ while(!this->Exports.empty())
+ {
+ cmTarget* te = this->Exports.back();
+ this->Exports.pop_back();
+ if (emitted.insert(te).second)
+ {
+ emittedDeps.insert(te);
+ this->GenerateImportTargetCode(os, te);
+
+ ImportPropertyMap properties;
+
+ this->FindTargets("INTERFACE_INCLUDE_DIRECTORIES", te, emittedDeps);
+ this->FindTargets("INTERFACE_COMPILE_DEFINITIONS", te, emittedDeps);
+
+ this->PopulateProperties(te, properties, emittedDeps);
+
+ this->GenerateInterfaceProperties(te, os, properties);
+ }
+ }
+ return true;
+}
+
+std::string cmExportTryCompileFileGenerator::FindTargets(const char *propName,
+ cmTarget *tgt,
+ std::set<cmTarget*> &emitted)
+{
+ const char *prop = tgt->GetProperty(propName);
+ if(!prop)
+ {
+ return std::string();
+ }
+
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+ tgt->GetName(),
+ propName, 0, 0);
+
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
+
+ cmTarget dummyHead;
+ dummyHead.SetType(cmTarget::EXECUTABLE, "try_compile_dummy_exe");
+ dummyHead.SetMakefile(tgt->GetMakefile());
+
+ std::string result = cge->Evaluate(tgt->GetMakefile(), this->Config,
+ false, &dummyHead, tgt, &dagChecker);
+
+ const std::set<cmTarget*> &allTargets = cge->GetAllTargetsSeen();
+ for(std::set<cmTarget*>::const_iterator li = allTargets.begin();
+ li != allTargets.end(); ++li)
+ {
+ if(emitted.insert(*li).second)
+ {
+ this->Exports.push_back(*li);
+ }
+ }
+ return result;
+}
+
+//----------------------------------------------------------------------------
+void
+cmExportTryCompileFileGenerator::PopulateProperties(cmTarget* target,
+ ImportPropertyMap& properties,
+ std::set<cmTarget*> &emitted)
+{
+ cmPropertyMap props = target->GetProperties();
+ for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i)
+ {
+ properties[i->first] = i->second.GetValue();
+
+ if(i->first.find("IMPORTED_LINK_INTERFACE_LIBRARIES") == 0)
+ {
+ const std::string libs = i->second.GetValue();
+
+ std::string evalResult = this->FindTargets(i->first.c_str(),
+ target, emitted);
+
+ std::vector<std::string> depends;
+ cmSystemTools::ExpandListArgument(evalResult, depends);
+ for(std::vector<std::string>::const_iterator li = depends.begin();
+ li != depends.end(); ++li)
+ {
+ cmTarget *tgt = target->GetMakefile()->FindTargetToUse(li->c_str());
+ if(tgt && emitted.insert(tgt).second)
+ {
+ this->Exports.push_back(tgt);
+ }
+ }
+ }
+ }
+}
diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h
new file mode 100644
index 0000000..ed393ab
--- /dev/null
+++ b/Source/cmExportTryCompileFileGenerator.h
@@ -0,0 +1,55 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2013 Stephen Kelly <steveire@gmail.com>
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmExportInstallFileGenerator_h
+#define cmExportInstallFileGenerator_h
+
+#include "cmExportFileGenerator.h"
+
+class cmInstallExportGenerator;
+class cmInstallTargetGenerator;
+
+class cmExportTryCompileFileGenerator: public cmExportFileGenerator
+{
+public:
+ /** Set the list of targets to export. */
+ void SetExports(const std::vector<cmTarget*> &exports)
+ { this->Exports = exports; }
+ void SetConfig(const char *config) { this->Config = config; }
+protected:
+
+ // Implement virtual methods from the superclass.
+ virtual bool GenerateMainFile(std::ostream& os);
+
+ virtual void GenerateImportTargetsConfig(std::ostream&,
+ const char*,
+ std::string const&,
+ std::vector<std::string>&) {}
+ virtual void HandleMissingTarget(std::string&,
+ std::vector<std::string>&,
+ cmMakefile*,
+ cmTarget*,
+ cmTarget*) {}
+
+ void PopulateProperties(cmTarget* target,
+ ImportPropertyMap& properties,
+ std::set<cmTarget*> &emitted);
+
+private:
+ std::string FindTargets(const char *prop, cmTarget *tgt,
+ std::set<cmTarget*> &emitted);
+
+
+ std::vector<cmTarget*> Exports;
+ const char *Config;
+};
+
+#endif
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 5d162fe..34d80ec 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -114,7 +114,8 @@ const char *cmCompiledGeneratorExpression::Evaluate(
this->HadContextSensitiveCondition = context.HadContextSensitiveCondition;
}
- this->Targets = context.Targets;
+ this->DependTargets = context.DependTargets;
+ this->AllTargetsSeen = context.AllTargets;
// TODO: Return a std::string from here instead?
return this->Output.c_str();
}
@@ -153,7 +154,8 @@ cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression()
}
//----------------------------------------------------------------------------
-static std::string stripEmptyListElements(const std::string &input)
+std::string cmGeneratorExpression::StripEmptyListElements(
+ const std::string &input)
{
std::string result;
@@ -223,7 +225,7 @@ static std::string stripAllGeneratorExpressions(const std::string &input)
lastPos = pos;
}
result += input.substr(lastPos);
- return stripEmptyListElements(result);
+ return cmGeneratorExpression::StripEmptyListElements(result);
}
//----------------------------------------------------------------------------
@@ -284,7 +286,7 @@ static std::string stripExportInterface(const std::string &input,
}
result += input.substr(lastPos);
- return stripEmptyListElements(result);
+ return cmGeneratorExpression::StripEmptyListElements(result);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 489b052..86b6f25 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -66,6 +66,7 @@ public:
static bool IsValidTargetName(const std::string &input);
+ static std::string StripEmptyListElements(const std::string &input);
private:
cmGeneratorExpression(const cmGeneratorExpression &);
void operator=(const cmGeneratorExpression &);
@@ -88,11 +89,14 @@ public:
/** Get set of targets found during evaluations. */
std::set<cmTarget*> const& GetTargets() const
- { return this->Targets; }
+ { return this->DependTargets; }
std::set<cmStdString> const& GetSeenTargetProperties() const
{ return this->SeenTargetProperties; }
+ std::set<cmTarget*> const& GetAllTargetsSeen() const
+ { return this->AllTargetsSeen; }
+
~cmCompiledGeneratorExpression();
std::string GetInput() const
@@ -123,7 +127,8 @@ private:
const std::string Input;
bool NeedsParsing;
- mutable std::set<cmTarget*> Targets;
+ mutable std::set<cmTarget*> DependTargets;
+ mutable std::set<cmTarget*> AllTargetsSeen;
mutable std::set<cmStdString> SeenTargetProperties;
mutable std::string Output;
mutable bool HadContextSensitiveCondition;
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 57e7358..5cb50b9 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -33,8 +33,8 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
}
this->CheckResult = this->checkGraph();
- if (CheckResult == DAG && (top->Property == "INCLUDE_DIRECTORIES"
- || top->Property == "COMPILE_DEFINITIONS") )
+ if (CheckResult == DAG && (top->EvaluatingIncludeDirectories()
+ || top->EvaluatingCompileDefinitions()))
{
std::map<cmStdString, std::set<cmStdString> >::const_iterator it
= top->Seen.find(target);
@@ -126,7 +126,7 @@ cmGeneratorExpressionDAGChecker::checkGraph() const
{
if (this->Target == parent->Target && this->Property == parent->Property)
{
- return parent->Parent ? CYCLIC_REFERENCE : SELF_REFERENCE;
+ return (parent == this->Parent) ? SELF_REFERENCE : CYCLIC_REFERENCE;
}
parent = parent->Parent;
}
@@ -153,7 +153,7 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries()
}
//----------------------------------------------------------------------------
-bool cmGeneratorExpressionDAGChecker::EvaluatingIncludeDirectories()
+bool cmGeneratorExpressionDAGChecker::EvaluatingIncludeDirectories() const
{
const char *prop = this->Property.c_str();
return (strcmp(prop, "INCLUDE_DIRECTORIES") == 0
@@ -161,7 +161,7 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingIncludeDirectories()
}
//----------------------------------------------------------------------------
-bool cmGeneratorExpressionDAGChecker::EvaluatingCompileDefinitions()
+bool cmGeneratorExpressionDAGChecker::EvaluatingCompileDefinitions() const
{
const char *prop = this->Property.c_str();
return (strcmp(prop, "COMPILE_DEFINITIONS") == 0
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index a2e5ce4..62a5cdf 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -38,8 +38,8 @@ struct cmGeneratorExpressionDAGChecker
const std::string &expr);
bool EvaluatingLinkLibraries();
- bool EvaluatingIncludeDirectories();
- bool EvaluatingCompileDefinitions();
+ bool EvaluatingIncludeDirectories() const;
+ bool EvaluatingCompileDefinitions() const;
private:
Result checkGraph() const;
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index b5fe8ba..e2d8777 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -376,6 +376,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
reportError(context, content->GetOriginalExpression(), e.str());
return std::string();
}
+ context->AllTargets.insert(target);
}
if (target == context->HeadTarget)
@@ -436,8 +437,6 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
const char *prop = target->GetProperty(propertyName.c_str());
- std::string linkedTargetsContent;
-
if (dagCheckerParent)
{
if (dagCheckerParent->EvaluatingLinkLibraries())
@@ -451,47 +450,74 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
{
assert(dagCheckerParent->EvaluatingIncludeDirectories()
|| dagCheckerParent->EvaluatingCompileDefinitions());
+ }
+ }
+
+ std::string linkedTargetsContent;
+
+ std::string interfacePropertyName;
+
+ if (propertyName == "INTERFACE_INCLUDE_DIRECTORIES"
+ || propertyName == "INCLUDE_DIRECTORIES")
+ {
+ interfacePropertyName = "INTERFACE_INCLUDE_DIRECTORIES";
+ }
+ else if (propertyName == "INTERFACE_COMPILE_DEFINITIONS"
+ || propertyName == "COMPILE_DEFINITIONS"
+ || strncmp(propertyName.c_str(), "COMPILE_DEFINITIONS_", 20) == 0)
+ {
+ interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS";
+ }
+
+ if (interfacePropertyName == "INTERFACE_INCLUDE_DIRECTORIES"
+ || interfacePropertyName == "INTERFACE_COMPILE_DEFINITIONS")
+ {
+ const cmTarget::LinkInterface *iface = target->GetLinkInterface(
+ context->Config,
+ context->HeadTarget);
+ if(iface)
+ {
+ cmGeneratorExpression ge(context->Backtrace);
- if (propertyName == "INTERFACE_INCLUDE_DIRECTORIES"
- || propertyName == "INTERFACE_COMPILE_DEFINITIONS")
+ std::string sep;
+ std::string depString;
+ for (std::vector<std::string>::const_iterator
+ it = iface->Libraries.begin();
+ it != iface->Libraries.end(); ++it)
{
- const cmTarget::LinkInterface *iface = target->GetLinkInterface(
- context->Config,
- context->HeadTarget);
- if(iface)
+ if (*it == target->GetName())
+ {
+ // Broken code can have a target in its own link interface.
+ // Don't follow such link interface entries so as not to create a
+ // self-referencing loop.
+ continue;
+ }
+ if (context->Makefile->FindTargetToUse(it->c_str()))
{
- cmGeneratorExpression ge(context->Backtrace);
-
- std::string sep;
- std::string depString;
- for (std::vector<std::string>::const_iterator
- it = iface->Libraries.begin();
- it != iface->Libraries.end(); ++it)
- {
- if (context->Makefile->FindTargetToUse(it->c_str()))
- {
- depString +=
- sep + "$<TARGET_PROPERTY:" + *it + "," + propertyName + ">";
- sep = ";";
- }
- }
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(depString);
- linkedTargetsContent = cge->Evaluate(context->Makefile,
- context->Config,
- context->Quiet,
- context->HeadTarget,
- target,
- &dagChecker);
- if (cge->GetHadContextSensitiveCondition())
- {
- context->HadContextSensitiveCondition = true;
- }
+ depString +=
+ sep + "$<TARGET_PROPERTY:" + *it + ","
+ + interfacePropertyName + ">";
+ sep = ";";
}
}
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(depString);
+ linkedTargetsContent = cge->Evaluate(context->Makefile,
+ context->Config,
+ context->Quiet,
+ context->HeadTarget,
+ target,
+ &dagChecker);
+ if (cge->GetHadContextSensitiveCondition())
+ {
+ context->HadContextSensitiveCondition = true;
+ }
}
}
+ linkedTargetsContent =
+ cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent);
+
if (!prop)
{
if (target->IsImported())
@@ -525,7 +551,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
sizeof(*targetPropertyTransitiveWhitelist));
++i)
{
- if (targetPropertyTransitiveWhitelist[i] == propertyName)
+ if (targetPropertyTransitiveWhitelist[i] == interfacePropertyName)
{
cmGeneratorExpression ge(context->Backtrace);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
@@ -836,7 +862,8 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
"Target \"" + name + "\" is not an executable or library.");
return std::string();
}
- context->Targets.insert(target);
+ context->DependTargets.insert(target);
+ context->AllTargets.insert(target);
std::string result =
TargetFilesystemArtifactResultCreator<linker, soname>::Create(
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index 37d5c86..ce7ad69 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -23,7 +23,8 @@ class cmTarget;
struct cmGeneratorExpressionContext
{
cmListFileBacktrace Backtrace;
- std::set<cmTarget*> Targets;
+ std::set<cmTarget*> DependTargets;
+ std::set<cmTarget*> AllTargets;
std::set<cmStdString> SeenTargetProperties;
cmMakefile *Makefile;
const char *Config;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ba29589..f2defbb 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1067,6 +1067,8 @@ bool cmGlobalGenerator::CheckTargets()
void cmGlobalGenerator::CreateAutomocTargets()
{
#ifdef CMAKE_BUILD_WITH_CMAKE
+ typedef std::vector<std::pair<cmQtAutomoc, cmTarget*> > Automocs;
+ Automocs automocs;
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
{
cmTargets& targets =
@@ -1084,11 +1086,17 @@ void cmGlobalGenerator::CreateAutomocTargets()
if(target.GetPropertyAsBool("AUTOMOC") && !target.IsImported())
{
cmQtAutomoc automoc;
- automoc.SetupAutomocTarget(&target);
+ automoc.InitializeMocSourceFile(&target);
+ automocs.push_back(std::make_pair(automoc, &target));
}
}
}
}
+ for (Automocs::iterator it = automocs.begin(); it != automocs.end();
+ ++it)
+ {
+ it->first.SetupAutomocTarget(it->second);
+ }
#endif
}
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 154aa32..63cbdb8 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -29,6 +29,7 @@ void cmGlobalVisualStudio7Generator
{
mf->AddDefinition("CMAKE_GENERATOR_RC", "rc");
mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
+ mf->AddDefinition("CMAKE_GENERATOR_FC", "ifort");
this->AddPlatformDefinitions(mf);
// Create list of configurations requested by user's cache, if any.
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 84cf6ca..a1c34f0 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -49,29 +49,29 @@ public:
/**
* Calls TraceVSDependencies() on all targets of this generator.
*/
- virtual void TraceDependencies();
+ void TraceDependencies();
virtual void AddHelperCommands() {}
/**
* Perform any final calculations prior to generation
*/
- virtual void ConfigureFinalPass();
+ void ConfigureFinalPass();
/**
* Generate the install rules files in this directory.
*/
- virtual void GenerateInstallRules();
+ void GenerateInstallRules();
/**
* Generate the test files for tests.
*/
- virtual void GenerateTestFiles();
+ void GenerateTestFiles();
/**
* Generate a manifest of target files that will be built.
*/
- virtual void GenerateTargetManifest();
+ void GenerateTargetManifest();
///! Get the makefile for this generator
cmMakefile *GetMakefile() {
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index 4818f1b..10ce641 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -119,6 +119,22 @@ cmQtAutomoc::cmQtAutomoc()
}
}
+void cmQtAutomoc::InitializeMocSourceFile(cmTarget* target)
+{
+ std::string automocTargetName = target->GetName();
+ cmMakefile *makefile = target->GetMakefile();
+ automocTargetName += "_automoc";
+ std::string mocCppFile = makefile->GetCurrentOutputDirectory();
+ mocCppFile += "/";
+ mocCppFile += automocTargetName;
+ mocCppFile += ".cpp";
+ cmSourceFile* mocCppSource = makefile->GetOrCreateSource(mocCppFile.c_str(),
+ true);
+ makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
+ mocCppFile.c_str(), false);
+
+ target->AddSourceFile(mocCppSource);
+}
void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
{
@@ -268,17 +284,6 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
outputFile += "/AutomocInfo.cmake";
makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(),
false, true, false);
-
- std::string mocCppFile = makefile->GetCurrentOutputDirectory();
- mocCppFile += "/";
- mocCppFile += automocTargetName;
- mocCppFile += ".cpp";
- cmSourceFile* mocCppSource = makefile->GetOrCreateSource(mocCppFile.c_str(),
- true);
- target->AddSourceFile(mocCppSource);
-
- makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
- mocCppFile.c_str(), false);
}
diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h
index 69da80e..962e254 100644
--- a/Source/cmQtAutomoc.h
+++ b/Source/cmQtAutomoc.h
@@ -23,6 +23,7 @@ public:
cmQtAutomoc();
bool Run(const char* targetDirectory);
+ void InitializeMocSourceFile(cmTarget* target);
void SetupAutomocTarget(cmTarget* target);
private:
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 003f3d8..717cfc8 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -92,6 +92,7 @@ public:
// Others not copied here are result caches.
this->SourceEntries = r.SourceEntries;
}
+ ~cmTargetInternals();
typedef cmTarget::SourceFileFlags SourceFileFlags;
std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap;
bool SourceFileFlagsConstructed;
@@ -138,9 +139,36 @@ public:
};
std::vector<IncludeDirectoriesEntry*> IncludeDirectoriesEntries;
std::vector<cmValueWithOrigin> LinkInterfaceIncludeDirectoriesEntries;
+
+ std::vector<IncludeDirectoriesEntry*>
+ CachedLinkInterfaceIncludeDirectoriesEntries;
+ std::map<std::string, std::string> CachedLinkInterfaceCompileDefinitions;
+
+ std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
+ std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone;
};
//----------------------------------------------------------------------------
+void deleteAndClear(
+ std::vector<cmTargetInternals::IncludeDirectoriesEntry*> &entries)
+{
+ for (std::vector<cmTargetInternals::IncludeDirectoriesEntry*>::const_iterator
+ it = entries.begin(),
+ end = entries.end();
+ it != end; ++it)
+ {
+ delete *it;
+ }
+ entries.clear();
+}
+
+//----------------------------------------------------------------------------
+cmTargetInternals::~cmTargetInternals()
+{
+ deleteAndClear(CachedLinkInterfaceIncludeDirectoriesEntries);
+}
+
+//----------------------------------------------------------------------------
cmTarget::cmTarget()
{
this->Makefile = 0;
@@ -2655,20 +2683,6 @@ void cmTarget::GatherDependencies( const cmMakefile& mf,
}
//----------------------------------------------------------------------------
-void deleteAndClear(
- std::vector<cmTargetInternals::IncludeDirectoriesEntry*> &entries)
-{
- for (std::vector<cmTargetInternals::IncludeDirectoriesEntry*>::const_iterator
- it = entries.begin(),
- end = entries.end();
- it != end; ++it)
- {
- delete *it;
- }
- entries.clear();
-}
-
-//----------------------------------------------------------------------------
void cmTarget::SetProperty(const char* prop, const char* value)
{
if (!prop)
@@ -2870,41 +2884,53 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
config,
debugIncludes);
- std::vector<cmTargetInternals::IncludeDirectoriesEntry*>
- linkInterfaceIncludeDirectoriesEntries;
-
- for (std::vector<cmValueWithOrigin>::const_iterator
- it = this->Internal->LinkInterfaceIncludeDirectoriesEntries.begin(),
- end = this->Internal->LinkInterfaceIncludeDirectoriesEntries.end();
- it != end; ++it)
+ std::string configString = config ? config : "";
+ if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[configString])
{
- {
- cmGeneratorExpression ge(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(it->Value);
- std::string result = cge->Evaluate(this->Makefile, config,
- false, this, 0, 0);
- if (!this->Makefile->FindTargetToUse(result.c_str()))
+ for (std::vector<cmValueWithOrigin>::const_iterator
+ it = this->Internal->LinkInterfaceIncludeDirectoriesEntries.begin(),
+ end = this->Internal->LinkInterfaceIncludeDirectoriesEntries.end();
+ it != end; ++it)
{
- continue;
+ {
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(it->Value);
+ std::string result = cge->Evaluate(this->Makefile, config,
+ false, this, 0, 0);
+ if (!this->Makefile->FindTargetToUse(result.c_str()))
+ {
+ continue;
+ }
}
- }
- cmGeneratorExpression ge(it->Backtrace);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
- "$<TARGET_PROPERTY:" + it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>");
+ cmGeneratorExpression ge(it->Backtrace);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
+ "$<TARGET_PROPERTY:" +
+ it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>");
- linkInterfaceIncludeDirectoriesEntries.push_back(
+ this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries.push_back(
new cmTargetInternals::IncludeDirectoriesEntry(cge));
+ }
}
processIncludeDirectories(this,
- linkInterfaceIncludeDirectoriesEntries,
+ this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries,
includes,
uniqueIncludes,
&dagChecker,
config,
debugIncludes);
- deleteAndClear(linkInterfaceIncludeDirectoriesEntries);
+ if (!this->Makefile->IsGeneratingBuildSystem())
+ {
+ deleteAndClear(
+ this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries);
+ }
+ else
+ {
+ this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[configString]
+ = true;
+ }
return includes;
}
@@ -2957,16 +2983,34 @@ std::string cmTarget::GetCompileDefinitions(const char *config)
}
}
- cmGeneratorExpression ge2(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge2 = ge2.Parse(depString);
- std::string depResult = cge2->Evaluate(this->Makefile,
- config,
- false,
- this,
- &dagChecker);
- if (!depResult.empty())
+ std::string configString = config ? config : "";
+ if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString])
+ {
+ cmGeneratorExpression ge2(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge2 =
+ ge2.Parse(depString);
+ this->Internal->CachedLinkInterfaceCompileDefinitions[configString] =
+ cge2->Evaluate(this->Makefile,
+ config,
+ false,
+ this,
+ &dagChecker);
+ }
+ if (!this->Internal->CachedLinkInterfaceCompileDefinitions[configString]
+ .empty())
+ {
+ result += (result.empty() ? "" : ";")
+ + this->Internal->CachedLinkInterfaceCompileDefinitions[configString];
+ }
+
+ if (!this->Makefile->IsGeneratingBuildSystem())
+ {
+ this->Internal->CachedLinkInterfaceCompileDefinitions[configString] = "";
+ }
+ else
{
- result += (result.empty() ? "" : ";") + depResult;
+ this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString]
+ = true;
}
return result;
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index 68ec666..6caa130 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -67,6 +67,7 @@ public:
" try_compile(RESULT_VAR <bindir> <srcfile>\n"
" [CMAKE_FLAGS flags...]\n"
" [COMPILE_DEFINITIONS flags...]\n"
+ " [LINK_LIBRARIES libs...]\n"
" [OUTPUT_VARIABLE <var>]\n"
" [COPY_FILE <fileName>])\n"
"Try building a source file into an executable. "
@@ -90,7 +91,12 @@ public:
"Some extra flags that can be included are, "
"INCLUDE_DIRECTORIES, LINK_DIRECTORIES, and LINK_LIBRARIES. "
"COMPILE_DEFINITIONS are -Ddefinition that will be passed to the "
- "compile line. "
+ "compile line.\n"
+ "The srcfile signature also accepts a LINK_LIBRARIES argument which "
+ "may contain a list of libraries or IMPORTED targets which will be "
+ "linked to in the generated project. If LINK_LIBRARIES is specified "
+ "as a parameter to try_compile, then any LINK_LIBRARIES passed as "
+ "CMAKE_FLAGS will be ignored.\n"
"try_compile creates a CMakeList.txt "
"file on the fly that looks like this:\n"
" add_definitions( <expanded COMPILE_DEFINITIONS from calling "
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index f8e4afd..13c2aad 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -50,6 +50,26 @@ if(BUILD_TESTING)
set(TEST_CompileCommandOutput 1)
endif()
+ set(MAKE_IS_GNU )
+ if(${CMAKE_TEST_MAKEPROGRAM} MATCHES make)
+ execute_process(COMMAND ${CMAKE_TEST_MAKEPROGRAM} no_such_target --version
+ RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out)
+ if("${res}" STREQUAL "0")
+ if("${out}" MATCHES "GNU")
+ set(MAKE_IS_GNU 1)
+ endif()
+ endif()
+ endif()
+
+ # some old versions of make simply cannot handle spaces in paths
+ if (MAKE_IS_GNU OR
+ "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR
+ "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland")
+ set(MAKE_SUPPORTS_SPACES 1)
+ else()
+ set(MAKE_SUPPORTS_SPACES 0)
+ endif()
+
set(build_generator_args
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
@@ -327,6 +347,7 @@ if(BUILD_TESTING)
--build-project ExternalDataTest
--build-noclean
--force-new-ctest-process
+ --build-options -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES}
--test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Module/ExternalData")
@@ -384,7 +405,8 @@ if(BUILD_TESTING)
# mainly it tests that cmake doesn't crash when generating these project files.
if(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop")
# check which generators we have
- exec_program(${CMAKE_CMAKE_COMMAND} ARGS --help OUTPUT_VARIABLE cmakeOutput )
+ execute_process(COMMAND ${CMAKE_CMAKE_COMMAND} --help
+ OUTPUT_VARIABLE cmakeOutput ERROR_VARIABLE cmakeOutput)
# check for the Eclipse generator
if ("${cmakeOutput}" MATCHES Eclipse)
add_test(Simple_EclipseGenerator ${CMAKE_CTEST_COMMAND}
@@ -1237,24 +1259,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/kwsys")
endif()
- set(MAKE_IS_GNU )
- if(${CMAKE_TEST_MAKEPROGRAM} MATCHES make)
- exec_program(
- ${CMAKE_TEST_MAKEPROGRAM} ARGS no_such_target --version
- RETURN_VALUE res OUTPUT_VARIABLE out
- )
- if("${res}" EQUAL 0)
- if("${out}" MATCHES "GNU")
- set(MAKE_IS_GNU 1)
- endif()
- endif()
- endif()
- # only add this test on platforms that support it
- # some old versions of make simply cannot handle spaces in paths
- if (MAKE_IS_GNU OR
- "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR
- "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland")
+ if(MAKE_SUPPORTS_SPACES)
add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/SubDirSpaces"
@@ -2397,7 +2403,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
if(TEST_CompileCommandOutput)
set(CompileCommandOutput_EXTRA_OPTIONS
- --build-options -DMAKE_SUPPORTS_SPACES=${MAKE_IS_GNU})
+ --build-options -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES})
ADD_TEST_MACRO(CompileCommandOutput
"${CMake_BINARY_DIR}/Tests/CMakeLib/runcompilecommands")
endif()
diff --git a/Tests/ExportImport/Import/CMakeLists.txt b/Tests/ExportImport/Import/CMakeLists.txt
index 3fc78a2..9c2d597 100644
--- a/Tests/ExportImport/Import/CMakeLists.txt
+++ b/Tests/ExportImport/Import/CMakeLists.txt
@@ -17,3 +17,5 @@ add_executable(imp_testTransExe1 imp_testTransExe1.c)
target_link_libraries(imp_testTransExe1 imp_lib1)
add_executable(imp_testTransExe1b imp_testTransExe1.c)
target_link_libraries(imp_testTransExe1b imp_lib1b)
+
+add_subdirectory(try_compile)
diff --git a/Tests/ExportImport/Import/try_compile/CMakeLists.txt b/Tests/ExportImport/Import/try_compile/CMakeLists.txt
new file mode 100644
index 0000000..5600dff
--- /dev/null
+++ b/Tests/ExportImport/Import/try_compile/CMakeLists.txt
@@ -0,0 +1,21 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+find_package(testLibRequired 2.5 REQUIRED)
+
+include(CheckCXXSourceCompiles)
+
+set(CMAKE_REQUIRED_LIBRARIES Req::testSharedLibRequired)
+check_cxx_source_compiles(
+ "
+#include \"testSharedLibRequired.h\"
+int main(int argc, char **argv)
+{
+ TestSharedLibRequired req;
+ return req.foo();
+}
+" SHARED_LIB_REQUIRED)
+
+if(NOT SHARED_LIB_REQUIRED)
+ message(SEND_ERROR "try_compile with IMPORTED targets failed!\n\n${OUTPUT}")
+endif()
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index bca149b..a77713f 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -43,6 +43,16 @@ if(NOT LOTSOFCOMPONENTS_FOUND)
message(SEND_ERROR "LotsOfComponents not found !")
endif()
+find_package(SomePackage)
+if(NOT SomePackage_FOUND)
+ message(SEND_ERROR "SomePackage with FOUND_VAR SomePackage_FOUND not found !")
+endif()
+
+find_package(UpperCasePackage)
+if(NOT UPPERCASEPACKAGE_FOUND)
+ message(SEND_ERROR "UpperCasePackage with FOUND_VAR UPPERCASEPACKAGE_FOUND not found !")
+endif()
+
#-----------------------------------------------------------------------------
# Test system package registry if possible.
set(CMakeTestSystemPackage "")
diff --git a/Tests/FindPackageTest/FindSomePackage.cmake b/Tests/FindPackageTest/FindSomePackage.cmake
new file mode 100644
index 0000000..83d1d0e
--- /dev/null
+++ b/Tests/FindPackageTest/FindSomePackage.cmake
@@ -0,0 +1,6 @@
+set(SOP_FOO TRUE)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(SomePackage REQUIRED_VARS SOP_FOO
+ FOUND_VAR SomePackage_FOUND )
diff --git a/Tests/FindPackageTest/FindUpperCasePackage.cmake b/Tests/FindPackageTest/FindUpperCasePackage.cmake
new file mode 100644
index 0000000..66c2fea
--- /dev/null
+++ b/Tests/FindPackageTest/FindUpperCasePackage.cmake
@@ -0,0 +1,6 @@
+set(UCP_FOO TRUE)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(UpperCasePackage REQUIRED_VARS UCP_FOO
+ FOUND_VAR UPPERCASEPACKAGE_FOUND )
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index ecbbedf..fff7c87 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 2.8.8)
-project(GeneratorExpression NONE)
+project(GeneratorExpression CXX)
add_custom_target(check-part1 ALL
COMMAND ${CMAKE_COMMAND}
@@ -62,6 +62,27 @@ add_custom_target(check-part1 ALL
VERBATIM
)
+add_library(empty1 empty.cpp)
+target_include_directories(empty1 PUBLIC /empty1/public)
+target_include_directories(empty1 PRIVATE /empty1/private)
+
+add_library(empty2 empty.cpp)
+target_include_directories(empty2 PUBLIC /empty2/public)
+
+add_library(empty3 empty.cpp)
+target_include_directories(empty3 PUBLIC /empty3/public)
+target_include_directories(empty3 PRIVATE /empty3/private)
+
+add_library(empty4 empty.cpp)
+target_include_directories(empty4 PUBLIC /empty4/public)
+
+target_link_libraries(empty1 LINK_PUBLIC empty2)
+target_link_libraries(empty2 LINK_PUBLIC empty3 empty4)
+target_link_libraries(empty3 LINK_PUBLIC empty2 empty4)
+
+add_library(empty5 empty.cpp)
+target_include_directories(empty5 PRIVATE /empty5/private1 /empty5/private2)
+
add_custom_target(check-part2 ALL
COMMAND ${CMAKE_COMMAND}
-Dtest_incomplete_1=$<
@@ -89,6 +110,14 @@ add_custom_target(check-part2 ALL
-Dtest_install_interface=$<INSTALL_INTERFACE:install>
-Dtest_target_name_1=$<TARGET_NAME:tgt,ok>
-Dtest_target_name_2=$<TARGET_NAME:tgt:ok>
+ -Dtest_target_includes1=$<TARGET_PROPERTY:empty1,INTERFACE_INCLUDE_DIRECTORIES>
+ -Dtest_target_includes2=$<TARGET_PROPERTY:empty2,INTERFACE_INCLUDE_DIRECTORIES>
+ -Dtest_target_includes3=$<TARGET_PROPERTY:empty3,INTERFACE_INCLUDE_DIRECTORIES>
+ -Dtest_target_includes4=$<TARGET_PROPERTY:empty1,INCLUDE_DIRECTORIES>
+ -Dtest_target_includes5=$<TARGET_PROPERTY:empty2,INCLUDE_DIRECTORIES>
+ -Dtest_target_includes6=$<TARGET_PROPERTY:empty3,INCLUDE_DIRECTORIES>
+ -Dtest_target_includes7=$<TARGET_PROPERTY:empty1,INTERFACE_INCLUDE_DIRECTORIES>
+ -Dtest_target_includes8=$<TARGET_PROPERTY:empty5,INCLUDE_DIRECTORIES>
-P ${CMAKE_CURRENT_SOURCE_DIR}/check-part2.cmake
COMMAND ${CMAKE_COMMAND} -E echo "check done (part 2 of 2)"
VERBATIM
diff --git a/Tests/GeneratorExpression/check-part2.cmake b/Tests/GeneratorExpression/check-part2.cmake
index 8855a97..3f7187c 100644
--- a/Tests/GeneratorExpression/check-part2.cmake
+++ b/Tests/GeneratorExpression/check-part2.cmake
@@ -26,3 +26,11 @@ check(test_build_interface "build")
check(test_install_interface "")
check(test_target_name_1 "tgt,ok")
check(test_target_name_2 "tgt:ok")
+check(test_target_includes1 "/empty1/public;/empty2/public;/empty3/public;/empty4/public")
+check(test_target_includes2 "/empty2/public;/empty3/public;/empty4/public")
+check(test_target_includes3 "/empty3/public;/empty2/public;/empty4/public")
+check(test_target_includes4 "/empty1/public;/empty1/private;/empty2/public;/empty3/public;/empty4/public")
+check(test_target_includes5 "/empty2/public;/empty3/public;/empty2/public;/empty4/public")
+check(test_target_includes6 "/empty3/public;/empty3/private;/empty2/public;/empty3/public;/empty4/public")
+check(test_target_includes7 "/empty1/public;/empty2/public;/empty3/public;/empty4/public")
+check(test_target_includes8 "/empty5/private1;/empty5/private2")
diff --git a/Tests/GeneratorExpression/empty.cpp b/Tests/GeneratorExpression/empty.cpp
new file mode 100644
index 0000000..c539901
--- /dev/null
+++ b/Tests/GeneratorExpression/empty.cpp
@@ -0,0 +1,2 @@
+
+// empty
diff --git a/Tests/Module/ExternalData/CMakeLists.txt b/Tests/Module/ExternalData/CMakeLists.txt
index 607e9b9..a379dca 100644
--- a/Tests/Module/ExternalData/CMakeLists.txt
+++ b/Tests/Module/ExternalData/CMakeLists.txt
@@ -14,10 +14,15 @@ set(ExternalData_URL_TEMPLATES
set(ExternalData_BINARY_ROOT "${CMAKE_CURRENT_BINARY_DIR}/ExternalData")
file(REMOVE_RECURSE ${ExternalData_BINARY_ROOT}) # clean test
+if(MAKE_SUPPORTS_SPACES)
+ set(Data1CheckSpaces -D "DataSpace=DATA{Data Space.dat}")
+endif()
+
ExternalData_Add_Test(Data1
NAME Data1Check
COMMAND ${CMAKE_COMMAND}
-D Data=DATA{Data.dat}
+ ${Data1CheckSpaces}
-D SeriesA=DATA{SeriesA.dat,:}
-D SeriesB=DATA{SeriesB.dat,:}
-D SeriesC=DATA{SeriesC.dat,:}
diff --git a/Tests/Module/ExternalData/Data Space.dat.md5 b/Tests/Module/ExternalData/Data Space.dat.md5
new file mode 100644
index 0000000..70e39bd
--- /dev/null
+++ b/Tests/Module/ExternalData/Data Space.dat.md5
@@ -0,0 +1 @@
+8c018830e3efa5caf3c7415028335a57
diff --git a/Tests/Module/ExternalData/Data1Check.cmake b/Tests/Module/ExternalData/Data1Check.cmake
index b99d7ae..f40b76c 100644
--- a/Tests/Module/ExternalData/Data1Check.cmake
+++ b/Tests/Module/ExternalData/Data1Check.cmake
@@ -2,6 +2,12 @@ file(STRINGS "${Data}" lines LIMIT_INPUT 1024)
if(NOT "x${lines}" STREQUAL "xInput file already transformed.")
message(SEND_ERROR "Input file:\n ${Data}\ndoes not have expected content, but [[${lines}]]")
endif()
+if(DEFINED DataSpace)
+ file(STRINGS "${DataSpace}" lines LIMIT_INPUT 1024)
+ if(NOT "x${lines}" STREQUAL "xInput file already transformed.")
+ message(SEND_ERROR "Input file:\n ${DataSpace}\ndoes not have expected content, but [[${lines}]]")
+ endif()
+endif()
set(SeriesAn1 "1\\.dat")
set(SeriesBn1 "_1\\.dat")
set(SeriesCn1 "\\.1\\.dat")
diff --git a/Tests/QtAutomoc/CMakeLists.txt b/Tests/QtAutomoc/CMakeLists.txt
index 530818e..ebfbb03 100644
--- a/Tests/QtAutomoc/CMakeLists.txt
+++ b/Tests/QtAutomoc/CMakeLists.txt
@@ -38,3 +38,9 @@ generate_export_header(libC)
target_link_libraries(libC LINK_PUBLIC libB)
target_link_libraries(foo codeeditorLib ${QT_LIBRARIES} libC)
+
+add_library(empty STATIC empty.cpp)
+set_target_properties(empty PROPERTIES AUTOMOC TRUE)
+target_link_libraries(empty no_link_language)
+add_library(no_link_language STATIC empty.h)
+set_target_properties(no_link_language PROPERTIES AUTOMOC TRUE)
diff --git a/Tests/QtAutomoc/empty.cpp b/Tests/QtAutomoc/empty.cpp
new file mode 100644
index 0000000..ab32cf6
--- /dev/null
+++ b/Tests/QtAutomoc/empty.cpp
@@ -0,0 +1 @@
+// No content
diff --git a/Tests/QtAutomoc/empty.h b/Tests/QtAutomoc/empty.h
new file mode 100644
index 0000000..4566142
--- /dev/null
+++ b/Tests/QtAutomoc/empty.h
@@ -0,0 +1,9 @@
+
+#include <QObject>
+
+class Empty : public QObject
+{
+ Q_OBJECT
+public:
+ explicit Empty(QObject *parent = 0) {}
+};
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index c55bb3a..dba772d 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -56,6 +56,7 @@ if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
add_RunCMake_test(CompilerChange)
endif()
add_RunCMake_test(ExternalData)
+add_RunCMake_test(FPHSA)
add_RunCMake_test(GeneratorExpression)
add_RunCMake_test(GeneratorToolset)
add_RunCMake_test(TargetPropertyGeneratorExpressions)
diff --git a/Tests/RunCMake/FPHSA/BadFoundVar-result.txt b/Tests/RunCMake/FPHSA/BadFoundVar-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/BadFoundVar-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt b/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt
new file mode 100644
index 0000000..4c739d8
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error at .*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \(message\):
+ The argument for FOUND_VAR is "badfoundvar_FOUND", but only
+ "BadFoundVar_FOUND" and "BADFOUNDVAR_FOUND" are valid names.
+Call Stack \(most recent call first\):
+ FindBadFoundVar.cmake:5 \(find_package_handle_standard_args\)
+ BadFoundVar.cmake:3 \(find_package\)
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/FPHSA/BadFoundVar.cmake b/Tests/RunCMake/FPHSA/BadFoundVar.cmake
new file mode 100644
index 0000000..07d4322
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/BadFoundVar.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+
+find_package(BadFoundVar REQUIRED)
diff --git a/Tests/RunCMake/FPHSA/CMakeLists.txt b/Tests/RunCMake/FPHSA/CMakeLists.txt
new file mode 100644
index 0000000..e8db6b0
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/FPHSA/FindBadFoundVar.cmake b/Tests/RunCMake/FPHSA/FindBadFoundVar.cmake
new file mode 100644
index 0000000..152df5c
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/FindBadFoundVar.cmake
@@ -0,0 +1,6 @@
+set(BFV_FOO TRUE)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(BadFoundVar REQUIRED_VARS BFV_FOO
+ FOUND_VAR badfoundvar_FOUND )
diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
new file mode 100644
index 0000000..0d48fa9
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(BadFoundVar)
diff --git a/bootstrap b/bootstrap
index 9a4f796..5c2addb 100755
--- a/bootstrap
+++ b/bootstrap
@@ -214,6 +214,7 @@ CMAKE_CXX_SOURCES="\
cmMakefile \
cmExportFileGenerator \
cmExportInstallFileGenerator \
+ cmExportTryCompileFileGenerator \
cmExportSet \
cmExportSetMap \
cmInstallDirectoryGenerator \