summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeCPack.cmake45
-rw-r--r--CMakeCPackOptions.cmake.in2
-rw-r--r--Modules/CMakeCUDACompiler.cmake.in2
-rw-r--r--Modules/CMakeCUDAInformation.cmake2
-rw-r--r--Modules/CheckFunctionExists.cmake30
-rw-r--r--Modules/Compiler/Clang-CXX-FeatureTests.cmake3
-rw-r--r--Modules/Compiler/Clang-CXX.cmake6
-rw-r--r--Modules/Platform/Windows-NVIDIA-CUDA.cmake2
-rw-r--r--Packaging/QtSDK/ToolsCMakeXX.cmake49
-rw-r--r--Packaging/QtSDK/qt.tools.cmake.xx.qs.in12
-rw-r--r--Source/CMakeLists.txt9
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestRunTest.cxx2
-rw-r--r--Source/QtIFW/CMake.DeveloperReference.HTML.qs.in4
-rw-r--r--Source/QtIFW/CMake.Dialogs.QtGUI.qs.in (renamed from Source/QtIFW/CMake.Dialogs.QtGUI.qs)4
-rw-r--r--Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in4
-rw-r--r--Source/QtIFW/CMake.qs.in10
-rw-r--r--Source/QtIFW/installscript.qs.in12
-rw-r--r--Source/cmCommonTargetGenerator.cxx7
-rw-r--r--Source/cmLinkLineComputer.cxx6
-rw-r--r--Source/cmLinkLineComputer.h4
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx6
-rw-r--r--Source/cmLinkLineDeviceComputer.h3
-rw-r--r--Source/cmLocalGenerator.cxx5
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx4
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx9
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx1
-rw-r--r--Source/cmQtAutoGeneratorInitializer.cxx8
-rw-r--r--Source/cmQtAutoGenerators.cxx699
-rw-r--r--Source/cmQtAutoGenerators.h84
-rw-r--r--Source/cmVSSetupHelper.cxx43
-rw-r--r--Tests/Cuda/CMakeLists.txt1
-rw-r--r--Tests/Cuda/ProperLinkFlags/CMakeLists.txt20
-rw-r--r--Tests/Cuda/ProperLinkFlags/file1.cu11
-rw-r--r--Tests/Cuda/ProperLinkFlags/file1.h7
-rw-r--r--Tests/Cuda/ProperLinkFlags/main.cxx9
-rw-r--r--Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake2
37 files changed, 646 insertions, 483 deletions
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake
index ba858bd..a0aacb4 100644
--- a/CMakeCPack.cmake
+++ b/CMakeCPack.cmake
@@ -54,6 +54,9 @@ if(${CPACK_SYSTEM_NAME} MATCHES Windows)
endif()
endif()
+# Command for configure IFW script templates
+include(${CMake_SOURCE_DIR}/Modules/CPackIFWConfigureFile.cmake)
+
# Advanced IFW configuration
set(_cpifwrc CPACK_IFW_COMPONENT_GROUP_CMAKE_)
set(_cpifwrcconf _CPACK_IFW_COMPONENT_GROUP_CMAKE)
@@ -85,8 +88,6 @@ _cmifwarg("Package <Default> tag (values: TRUE, FALSE, SCRIPT)"
_cmifwarg("Package <Version> tag"
STRING VERSION
"${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
-_cmifwarg("Package <Script> tag"
- FILEPATH SCRIPT "${CMake_BINARY_DIR}/installscript.qs")
_cmifwarg("Package <SortingPriority> tag"
STRING PRIORITY "100")
_cmifwarg("Package <ForsedInstallation> tag"
@@ -148,33 +149,22 @@ if(CMake_INSTALL_COMPONENTS)
set(CPACK_COMPONENTS_ALL \"${_CPACK_IFW_COMPONENTS_ALL}\")
set(CPACK_COMPONENTS_GROUPING IGNORE)
")
+ _cmifwarg("Package <Script> template"
+ FILEPATH SCRIPT_TEMPLATE "${CMake_SOURCE_DIR}/Source/QtIFW/CMake.qs.in")
else()
if(BUILD_QtDialog AND USE_LGPL)
set(${_cpifwrc}LICENSES_DEFAULT
"${${_cpifwrc}LICENSES_DEFAULT};LGPLv${USE_LGPL};${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt")
endif()
+ _cmifwarg("Package <Script> template"
+ FILEPATH SCRIPT_TEMPLATE "${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in")
endif()
+_cmifwarg("Package <Script> generated"
+ FILEPATH SCRIPT_GENERATED "${CMake_BINARY_DIR}/CMake.qs")
_cmifwarg("Package <Licenses> tag (pairs of <display_name> <file_path>)"
STRING LICENSES "${${_cpifwrc}LICENSES_DEFAULT}")
-# Components scripts configuration
-if(CMake_INSTALL_COMPONENTS)
- configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/CMake.qs.in"
- "${CMake_BINARY_DIR}/installscript.qs" @ONLY
- )
-else()
- configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in"
- "${CMake_BINARY_DIR}/installscript.qs" @ONLY
- )
-endif()
-foreach(_script
- CMake.Documentation.SphinxHTML
- CMake.DeveloperReference.HTML)
- configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/${_script}.qs.in"
- "${CMake_BINARY_DIR}/${_script}.qs" @ONLY)
-endforeach()
-
if(${CMAKE_SYSTEM_NAME} MATCHES Windows)
set(_CPACK_IFW_PACKAGE_ICON
"set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")")
@@ -199,6 +189,23 @@ if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
set(CPACK_IFW_ADMIN_TARGET_DIRECTORY "@ApplicationsDir@/${CMAKE_PROJECT_NAME}")
endif()
+# Components scripts configuration
+if((EXISTS "${CMake_IFW_ROOT_COMPONENT_SCRIPT_TEMPLATE}")
+ AND (NOT "${CMake_IFW_ROOT_COMPONENT_SCRIPT_GENERATED}" STREQUAL "")
+ AND (NOT "${CMake_IFW_ROOT_COMPONENT_SCRIPT}"))
+ cpack_ifw_configure_file("${CMake_IFW_ROOT_COMPONENT_SCRIPT_TEMPLATE}"
+ "${CMake_IFW_ROOT_COMPONENT_SCRIPT_GENERATED}")
+ _cmifwarg("Package <Script> tag"
+ FILEPATH SCRIPT "${CMake_IFW_ROOT_COMPONENT_SCRIPT_GENERATED}")
+endif()
+foreach(_script
+ CMake.Dialogs.QtGUI
+ CMake.Documentation.SphinxHTML
+ CMake.DeveloperReference.HTML)
+ cpack_ifw_configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/${_script}.qs.in"
+ "${CMake_BINARY_DIR}/${_script}.qs")
+endforeach()
+
if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
# if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
# default to source package - system, on cygwin system is not
diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in
index 99746b0..ad0c245 100644
--- a/CMakeCPackOptions.cmake.in
+++ b/CMakeCPackOptions.cmake.in
@@ -132,7 +132,7 @@ if(CPACK_GENERATOR MATCHES "IFW")
set(CPACK_COMPONENT_CMAKE-GUI_GROUP Dialogs)
set(CPACK_IFW_COMPONENT_CMAKE-GUI_NAME "QtGUI")
set(CPACK_IFW_COMPONENT_CMAKE-GUI_SCRIPT
- "@CMake_SOURCE_DIR@/Source/QtIFW/CMake.Dialogs.QtGUI.qs")
+ "@CMake_BINARY_DIR@/CMake.Dialogs.QtGUI.qs")
set(CPACK_IFW_COMPONENT_CMAKE-GUI_VERSION
"@CMake_IFW_ROOT_COMPONENT_VERSION@")
@_CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES@
diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in
index 1ba42d9..7e8efa7 100644
--- a/Modules/CMakeCUDACompiler.cmake.in
+++ b/Modules/CMakeCUDACompiler.cmake.in
@@ -13,6 +13,8 @@ set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX")
set(CMAKE_CUDA_COMPILER_ID_RUN 1)
set(CMAKE_CUDA_SOURCE_FILE_EXTENSIONS cu)
+set(CMAKE_CUDA_LINKER_PREFERENCE 10)
+set(CMAKE_CUDA_LINKER_PREFERENCE_PROPAGATES 1)
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@")
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
index abc4b66..13b1789 100644
--- a/Modules/CMakeCUDAInformation.cmake
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -187,7 +187,7 @@ if(NOT CMAKE_CUDA_DEVICE_LINK_LIBRARY)
endif()
if(NOT CMAKE_CUDA_DEVICE_LINK_EXECUTABLE)
set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE
- "<CMAKE_CUDA_COMPILER> <CMAKE_CUDA_LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+ "<CMAKE_CUDA_COMPILER> <FLAGS> <CMAKE_CUDA_LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
endif()
mark_as_advanced(
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake
index 5f049e7..ef08062 100644
--- a/Modules/CheckFunctionExists.cmake
+++ b/Modules/CheckFunctionExists.cmake
@@ -5,18 +5,16 @@
# CheckFunctionExists
# -------------------
#
-# Check if a C function can be linked
+# Check if a C function can be linked::
#
-# CHECK_FUNCTION_EXISTS(<function> <variable>)
+# check_function_exists(<function> <variable>)
#
-# Check that the <function> is provided by libraries on the system and
-# store the result in a <variable>. This does not verify that any
-# system header file declares the function, only that it can be found at
-# link time (consider using CheckSymbolExists).
-# <variable> will be created as an internal cache variable.
+# Check that the ``<function>`` is provided by libraries on the system and store
+# the result in a ``<variable>``. ``<variable>`` will be created as an internal
+# cache variable.
#
-# The following variables may be set before calling this macro to modify
-# the way the check is run:
+# The following variables may be set before calling this macro to modify the
+# way the check is run:
#
# ::
#
@@ -25,6 +23,20 @@
# CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
+#
+# .. note::
+#
+# Prefer using :Module:`CheckSymbolExists` instead of this module,
+# for the following reasons:
+#
+# * ``check_function_exists()`` can't detect functions that are inlined
+# in headers or specified as a macro.
+#
+# * ``check_function_exists()`` can't detect anything in the 32-bit
+# versions of the Win32 API, because of a mismatch in calling conventions.
+#
+# * ``check_function_exists()`` only verifies linking, it does not verify
+# that the function is declared in system headers.
macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
diff --git a/Modules/Compiler/Clang-CXX-FeatureTests.cmake b/Modules/Compiler/Clang-CXX-FeatureTests.cmake
index df2e1a8..cd04190 100644
--- a/Modules/Compiler/Clang-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/Clang-CXX-FeatureTests.cmake
@@ -2,7 +2,7 @@
# Reference: http://clang.llvm.org/cxx_status.html
# http://clang.llvm.org/docs/LanguageExtensions.html
-set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 304")
+set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 301")
include("${CMAKE_CURRENT_LIST_DIR}/Clang-CXX-TestableFeatures.cmake")
@@ -15,7 +15,6 @@ set(_cmake_feature_test_cxx_digit_separators "${Clang34_CXX14}")
# http://llvm.org/bugs/show_bug.cgi?id=19674
set(_cmake_feature_test_cxx_generic_lambdas "${Clang34_CXX14}")
-# TODO: Should be supported by Clang 3.1
set(Clang31_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
set(_cmake_feature_test_cxx_enum_forward_declarations "${Clang31_CXX11}")
set(_cmake_feature_test_cxx_sizeof_member "${Clang31_CXX11}")
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index d0e2521..8ed3695 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -36,7 +36,7 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1)
if (NOT CMAKE_CXX_COMPILER_FORCED)
if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
@@ -50,14 +50,14 @@ endif()
macro(cmake_record_cxx_compile_features)
set(_result 0)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1)
if(_result EQUAL 0 AND CMAKE_CXX17_STANDARD_COMPILE_OPTION)
_record_compiler_features_cxx(17)
endif()
if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION)
_record_compiler_features_cxx(14)
endif()
- if (_result EQUAL 0)
+ if (_result EQUAL 0 AND CMAKE_CXX11_STANDARD_COMPILE_OPTION)
_record_compiler_features_cxx(11)
endif()
if (_result EQUAL 0)
diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
index 80ecfbc..809ee06 100644
--- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake
+++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
@@ -33,7 +33,7 @@ unset(_CMAKE_VS_LINK_EXE)
set(CMAKE_CUDA_DEVICE_LINK_LIBRARY
"<CMAKE_CUDA_COMPILER> <CMAKE_CUDA_LINK_FLAGS> <LANGUAGE_COMPILE_FLAGS> -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE
- "<CMAKE_CUDA_COMPILER> <CMAKE_CUDA_LINK_FLAGS> -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
+ "<CMAKE_CUDA_COMPILER> <FLAGS> <CMAKE_CUDA_LINK_FLAGS> -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
string(APPEND CMAKE_CUDA_FLAGS_INIT " -Xcompiler=-GR,-EHsc")
string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -Xcompiler=-MDd,-Zi,-RTC1")
diff --git a/Packaging/QtSDK/ToolsCMakeXX.cmake b/Packaging/QtSDK/ToolsCMakeXX.cmake
index e227b73..c5f8f34 100644
--- a/Packaging/QtSDK/ToolsCMakeXX.cmake
+++ b/Packaging/QtSDK/ToolsCMakeXX.cmake
@@ -3,38 +3,29 @@
# CMake version
include("${CMAKE_CURRENT_LIST_DIR}/../../Source/CMakeVersion.cmake")
-set(CM_VER_XY ${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR})
-set(CM_VER_X_Y ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR})
-set(CM_VER_X_Y_Z ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATH})
-# Destiantion
-set(CM_INST_PREF "Tools/CMake/${CM_VER_X_Y}")
-set(CMAKE_BIN_DIR "${CM_INST_PREF}/bin"
- CACHE STRING "Location under install bin")
-set(CMAKE_DATA_DIR "${CM_INST_PREF}/share/cmake-${CM_VER_X_Y}"
- CACHE STRING "Location under install data")
-set(CMAKE_DOC_DIR "${CM_INST_PREF}/doc/cmake-${CM_VER_X_Y}"
- CACHE STRING "Location under install docs")
-set(CMAKE_MAN_DIR "${CM_INST_PREF}/man"
- CACHE STRING "Location under install man pages")
-set(CMAKE_XDGDATA_DIR "${CM_INST_PREF}/share"
- CACHE STRING "Location under install XDG specific files")
+# Install destinations
+set(CMake_INSTALL_INFIX "Tools/CMake/${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/"
+ CACHE STRING "Location under install CMake tools")
# Package
set(CMake_IFW_ROOT_COMPONENT_NAME
- "qt.tools.cmake.${CM_VER_XY}"
+ "qt.tools.cmake.${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}"
CACHE STRING "QtSDK CMake tools component name")
set(CMake_IFW_ROOT_COMPONENT_DISPLAY_NAME
- "CMake ${CM_VER_X_Y}"
+ "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}"
CACHE STRING "QtSDK CMake tools component display name")
set(CMake_IFW_ROOT_COMPONENT_DESCRIPTION
- "CMake Build Tools ${CM_VER_X_Y_Z}"
+ "CMake Build Tools ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATH}"
CACHE STRING "QtSDK CMake tools component description")
-set(CMake_IFW_ROOT_COMPONENT_SCRIPT
- "${CMAKE_CURRENT_BINARY_DIR}/qt.tools.cmake.${CM_VER_XY}.qs"
- CACHE STRING "QtSDK CMake tools component display name")
+set(CMake_IFW_ROOT_COMPONENT_SCRIPT_TEMPLATE
+ "${CMAKE_CURRENT_LIST_DIR}/qt.tools.cmake.xx.qs.in"
+ CACHE FILEPATH "QtSDK CMake tools script template")
+set(CMake_IFW_ROOT_COMPONENT_SCRIPT_GENERATED
+ "${CMAKE_CURRENT_BINARY_DIR}/qt.tools.cmake.${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}.qs"
+ CACHE FILEPATH "QtSDK CMake tools script generated")
set(CMake_IFW_ROOT_COMPONENT_PRIORITY
- "${CM_VER_XY}"
+ "${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}"
CACHE STRING "QtSDK CMake tools component sorting priority")
set(CMake_IFW_ROOT_COMPONENT_DEFAULT ""
CACHE STRING "QtSDK CMake tools component default")
@@ -52,17 +43,3 @@ set(CPACK_IFW_DOWNLOAD_ALL "TRUE"
CACHE STRING "All QtSDK components is downloaded")
set(CPACK_DOWNLOAD_SITE "file:///${CMAKE_CURRENT_BINARY_DIR}/QtSDK/IFW/CMake/repository"
CACHE STRING "Local repository for testing")
-
-# Script
-set(SDKToolBinary "@SDKToolBinary@")
-set(CM_VER_XY_DIR "@CMAKE${CM_VER_XY}_DIR@")
-configure_file("${CMAKE_CURRENT_LIST_DIR}/qt.tools.cmake.xx.qs.in"
- "${CMAKE_CURRENT_BINARY_DIR}/qt.tools.cmake.${CM_VER_XY}.qs"
- @ONLY)
-
-# Unset temporary variables
-unset(CM_VER_XY)
-unset(CM_VER_X_Y)
-unset(CM_VER_X_Y_Z)
-unset(CM_INST_PREF)
-unset(SDKToolBinary)
diff --git a/Packaging/QtSDK/qt.tools.cmake.xx.qs.in b/Packaging/QtSDK/qt.tools.cmake.xx.qs.in
index cb42a71..81ce157 100644
--- a/Packaging/QtSDK/qt.tools.cmake.xx.qs.in
+++ b/Packaging/QtSDK/qt.tools.cmake.xx.qs.in
@@ -9,15 +9,15 @@
function Component()
{
installer.valueChanged.connect( this, Component.prototype.reactOnTargetDirChange );
- // set the default values to CMAKE@CM_VER_XY@_DIR
+ // set the default values to CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_BIN_DIR
Component.prototype.reactOnTargetDirChange("TargetDir", installer.value("TargetDir"));
}
Component.prototype.reactOnTargetDirChange = function(key, value)
{
if (key == "TargetDir") {
- var path = value + "/@CM_INST_PREF@";
- installer.setValue("CMAKE@CM_VER_XY@_DIR", path.replace(/\\/g, "/"));
+ var path = value + "/%CMAKE_BIN_DIR%";
+ installer.setValue("CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_BIN_DIR", path.replace(/\\/g, "/"));
}
}
@@ -31,13 +31,13 @@ Component.prototype.createOperations = function()
return;
var cmId = component.name;
- installer.setValue("CMAKE@CM_VER_XY@_ID", cmId);
+ installer.setValue("CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_ID", cmId);
component.addOperation("Execute",
["{0,2}", "@SDKToolBinary@", "addCMake",
"--id", cmId,
- "--name", "@CMake_IFW_ROOT_COMPONENT_DISPLAY_NAME@",
- "--path", "@CM_VER_XY_DIR@/bin/cmake.exe",
+ "--name", "%CMake_IFW_ROOT_COMPONENT_DISPLAY_NAME%",
+ "--path", "@CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_BIN_DIR@/cmake.exe",
"UNDOEXECUTE",
"@SDKToolBinary@", "rmCMake", "--id", cmId]);
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 57b7b25..2835ee6 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -787,6 +787,15 @@ target_link_libraries(CMakeLib cmsys
${CMake_KWIML_LIBRARIES}
)
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
+ # the atomic instructions are implemented using libatomic on some platforms,
+ # so linking to that may be required
+ check_library_exists(atomic __atomic_fetch_add_4 "" LIBATOMIC_NEEDED)
+ if(LIBATOMIC_NEEDED)
+ target_link_libraries(CMakeLib atomic)
+ endif()
+endif()
+
# On Apple we need CoreFoundation
if(APPLE)
target_link_libraries(CMakeLib "-framework CoreFoundation")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 5ac4cf1..0c64d70 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 7)
-set(CMake_VERSION_PATCH 20170113)
+set(CMake_VERSION_PATCH 20170116)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 5c45fe5..ac1644f 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -134,6 +134,7 @@ void cmCTestRunTest::CompressOutput()
size_t rlen = cmsysBase64_Encode(out, strm.total_out, encoded_buffer, 1);
+ this->CompressedOutput.clear();
for (size_t i = 0; i < rlen; i++) {
this->CompressedOutput += encoded_buffer[i];
}
@@ -416,6 +417,7 @@ bool cmCTestRunTest::StartTest(size_t total)
<< std::setw(getNumWidth(this->TestHandler->GetMaxIndex()))
<< this->TestProperties->Index << ": "
<< this->TestProperties->Name << std::endl);
+ this->ProcessOutput.clear();
this->ComputeArguments();
std::vector<std::string>& args = this->TestProperties->Args;
this->TestResult.Properties = this->TestProperties;
diff --git a/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in b/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in
index e3d8554..8cc5835 100644
--- a/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in
+++ b/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in
@@ -11,8 +11,8 @@ Component.prototype.createOperations = function()
if (installer.value("os") === "win") {
component.addOperation("CreateShortcut",
- installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/developer-reference/html/index.html",
- installer.value("StartMenuDir") + "/CMake Developer Reference.lnk");
+ "@TargetDir@/%CMAKE_DOC_DIR%/developer-reference/html/index.html",
+ "@StartMenuDir@/CMake Developer Reference.lnk");
}
diff --git a/Source/QtIFW/CMake.Dialogs.QtGUI.qs b/Source/QtIFW/CMake.Dialogs.QtGUI.qs.in
index 219a0a9..71f395a 100644
--- a/Source/QtIFW/CMake.Dialogs.QtGUI.qs
+++ b/Source/QtIFW/CMake.Dialogs.QtGUI.qs.in
@@ -11,8 +11,8 @@ Component.prototype.createOperations = function()
if (installer.value("os") === "win") {
component.addOperation("CreateShortcut",
- installer.value("TargetDir") + "/bin/cmake-gui.exe",
- installer.value("StartMenuDir") + "/CMake (cmake-gui).lnk");
+ "@TargetDir@/%CMAKE_BIN_DIR%/cmake-gui.exe",
+ "@StartMenuDir@/CMake (cmake-gui).lnk");
}
diff --git a/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in b/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in
index 5c929e8..54bc14a 100644
--- a/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in
+++ b/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in
@@ -11,8 +11,8 @@ Component.prototype.createOperations = function()
if (installer.value("os") === "win") {
component.addOperation("CreateShortcut",
- installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/html/index.html",
- installer.value("StartMenuDir") + "/CMake Documentation.lnk");
+ "@TargetDir@/%CMAKE_DOC_DIR%/html/index.html",
+ "@StartMenuDir@/CMake Documentation.lnk");
}
diff --git a/Source/QtIFW/CMake.qs.in b/Source/QtIFW/CMake.qs.in
index 828cc7c..1f3166e 100644
--- a/Source/QtIFW/CMake.qs.in
+++ b/Source/QtIFW/CMake.qs.in
@@ -1,3 +1,5 @@
+// Component: CMake
+
function Component()
{
// Default constructor
@@ -9,12 +11,12 @@ Component.prototype.createOperations = function()
if (installer.value("os") === "win") {
component.addOperation("CreateShortcut",
- installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/cmake.org.html",
- installer.value("StartMenuDir") + "/CMake Web Site.lnk");
+ "@TargetDir@/%CMAKE_DOC_DIR%/cmake.org.html",
+ "@StartMenuDir@/CMake Web Site.lnk");
component.addOperation("CreateShortcut",
- installer.value("TargetDir") + "/cmake-maintenance.exe",
- installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk");
+ "@TargetDir@/cmake-maintenance.exe",
+ "@StartMenuDir@/CMake Maintenance Tool.lnk");
}
// Call default implementation
diff --git a/Source/QtIFW/installscript.qs.in b/Source/QtIFW/installscript.qs.in
index 39a8795..72d49e8 100644
--- a/Source/QtIFW/installscript.qs.in
+++ b/Source/QtIFW/installscript.qs.in
@@ -1,3 +1,5 @@
+// Component: CMake
+
function Component()
{
// Do not show component selection page
@@ -9,15 +11,15 @@ Component.prototype.createOperations = function()
// Create shortcut
if (installer.value("os") === "win") {
-@_CPACK_IFW_SHORTCUT_OPTIONAL@
+%_CPACK_IFW_SHORTCUT_OPTIONAL%
component.addOperation("CreateShortcut",
- installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/cmake.org.html",
- installer.value("StartMenuDir") + "/CMake Web Site.lnk");
+ "@TargetDir@/%CMAKE_DOC_DIR%/cmake.org.html",
+ "@StartMenuDir@/CMake Web Site.lnk");
component.addOperation("CreateShortcut",
- installer.value("TargetDir") + "/cmake-maintenance.exe",
- installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk");
+ "@TargetDir@/cmake-maintenance.exe",
+ "@StartMenuDir@/CMake Maintenance Tool.lnk");
}
// Call default implementation
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 7e113ab..239582f 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -63,6 +63,13 @@ void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags,
void cmCommonTargetGenerator::AddModuleDefinitionFlag(
cmLinkLineComputer* linkLineComputer, std::string& flags)
{
+ // A module definition file only makes sense on certain target types.
+ if (this->GeneratorTarget->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ this->GeneratorTarget->GetType() != cmStateEnums::MODULE_LIBRARY &&
+ this->GeneratorTarget->GetType() != cmStateEnums::EXECUTABLE) {
+ return;
+ }
+
if (!this->ModuleDefinitionFile) {
return;
}
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index cf0cf88..e728632 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -184,3 +184,9 @@ std::string cmLinkLineComputer::ComputeLinkLibraries(
return fout.str();
}
+
+std::string cmLinkLineComputer::GetLinkerLanguage(cmGeneratorTarget* target,
+ std::string const& config)
+{
+ return target->GetLinkerLanguage(config);
+}
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index bb13717..57a70bc 100644
--- a/Source/cmLinkLineComputer.h
+++ b/Source/cmLinkLineComputer.h
@@ -11,6 +11,7 @@
#include "cmStateDirectory.h"
class cmComputeLinkInformation;
+class cmGeneratorTarget;
class cmOutputConverter;
class cmLinkLineComputer
@@ -36,6 +37,9 @@ public:
virtual std::string ComputeLinkLibraries(cmComputeLinkInformation& cli,
std::string const& stdLibString);
+ virtual std::string GetLinkerLanguage(cmGeneratorTarget* target,
+ std::string const& config);
+
protected:
std::string ComputeLinkLibs(cmComputeLinkInformation& cli);
std::string ComputeRPath(cmComputeLinkInformation& cli);
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index 75e5ef5..6a700ff 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -59,6 +59,12 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries(
return fout.str();
}
+std::string cmLinkLineDeviceComputer::GetLinkerLanguage(cmGeneratorTarget*,
+ std::string const&)
+{
+ return "CUDA";
+}
+
cmNinjaLinkLineDeviceComputer::cmNinjaLinkLineDeviceComputer(
cmOutputConverter* outputConverter, cmStateDirectory stateDir,
cmGlobalNinjaGenerator const* gg)
diff --git a/Source/cmLinkLineDeviceComputer.h b/Source/cmLinkLineDeviceComputer.h
index d1079d7..f4bb3eb 100644
--- a/Source/cmLinkLineDeviceComputer.h
+++ b/Source/cmLinkLineDeviceComputer.h
@@ -17,6 +17,9 @@ public:
std::string ComputeLinkLibraries(cmComputeLinkInformation& cli,
std::string const& stdLibString)
CM_OVERRIDE;
+
+ std::string GetLinkerLanguage(cmGeneratorTarget* target,
+ std::string const& config) CM_OVERRIDE;
};
class cmNinjaLinkLineDeviceComputer : public cmLinkLineDeviceComputer
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index ead1e72..44c390c 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -13,6 +13,7 @@
#include "cmInstallScriptGenerator.h"
#include "cmInstallTargetGenerator.h"
#include "cmLinkLineComputer.h"
+#include "cmLinkLineDeviceComputer.h"
#include "cmMakefile.h"
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
@@ -979,7 +980,9 @@ void cmLocalGenerator::GetTargetFlags(
linkFlags += this->Makefile->GetSafeDefinition(build);
linkFlags += " ";
}
- std::string linkLanguage = target->GetLinkerLanguage(buildType);
+
+ const std::string linkLanguage =
+ linkLineComputer->GetLinkerLanguage(target, buildType);
if (linkLanguage.empty()) {
cmSystemTools::Error(
"CMake can not determine linker language for target: ",
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index ba17f81..41a4caf 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1592,8 +1592,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
// Provide a "/fast" version of the target.
depends.clear();
- if ((targetName == "install") || (targetName == "install_local") ||
- (targetName == "install_strip")) {
+ if ((targetName == "install") || (targetName == "install/local") ||
+ (targetName == "install/strip")) {
// Provide a fast install target that does not depend on all
// but has the same command.
depends.push_back("preinstall/fast");
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 4bc706c..b76ddeb 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -157,15 +157,6 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
this->LocalGenerator->AppendFlags(
linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
- {
- CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
- this->CreateLinkLineComputer(
- this->LocalGenerator,
- this->LocalGenerator->GetStateSnapshot().GetDirectory()));
-
- this->AddModuleDefinitionFlag(linkLineComputer.get(), linkFlags);
- }
-
// Construct a list of files associated with this executable that
// may need to be cleaned.
std::vector<std::string> exeCleanFiles;
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index bc8d8ff..b172478 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -663,7 +663,6 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement()
this->addPoolNinjaVariable("JOB_POOL_LINK", &genTarget, vars);
- this->AddModuleDefinitionFlag(linkLineComputer.get(), vars["LINK_FLAGS"]);
vars["LINK_FLAGS"] =
cmGlobalNinjaGenerator::EncodeLiteral(vars["LINK_FLAGS"]);
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 6d4c302..825eba0 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -674,6 +674,14 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
const std::string qtMajorVersion = GetQtMajorVersion(target);
std::vector<std::string> autogenOutputFiles;
+ // Remove old settings on cleanup
+ {
+ std::string fname = GetAutogenTargetFilesDir(target);
+ fname += "/AutogenOldSettings.cmake";
+ makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", fname.c_str(),
+ false);
+ }
+
// Create autogen target build directory and add it to the clean files
cmSystemTools::MakeDirectory(autogenBuildDir);
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index f5c33fe..c84fe4f 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -27,7 +27,39 @@
#include <unistd.h>
#endif
-static std::string findMatchingHeader(
+// -- Static variables
+
+static const char* MocOldSettingsKey = "AM_MOC_OLD_SETTINGS";
+static const char* UicOldSettingsKey = "AM_UIC_OLD_SETTINGS";
+static const char* RccOldSettingsKey = "AM_RCC_OLD_SETTINGS";
+
+// -- Static functions
+
+static std::string GetConfigDefinition(cmMakefile* makefile,
+ const std::string& key,
+ const std::string& config)
+{
+ std::string keyConf = key;
+ if (!config.empty()) {
+ keyConf += "_";
+ keyConf += config;
+ }
+ const char* valueConf = makefile->GetDefinition(keyConf);
+ if (valueConf != CM_NULLPTR) {
+ return valueConf;
+ }
+ return makefile->GetSafeDefinition(key);
+}
+
+static std::string OldSettingsFile(const std::string& targetDirectory)
+{
+ std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
+ cmSystemTools::ConvertToUnixSlashes(filename);
+ filename += "/AutogenOldSettings.cmake";
+ return filename;
+}
+
+static std::string FindMatchingHeader(
const std::string& absPath, const std::string& mocSubDir,
const std::string& basename,
const std::vector<std::string>& headerExtensions)
@@ -53,7 +85,7 @@ static std::string findMatchingHeader(
return header;
}
-static std::string extractSubDir(const std::string& absPath,
+static std::string ExtractSubDir(const std::string& absPath,
const std::string& currentMoc)
{
std::string subDir;
@@ -89,44 +121,60 @@ static std::string ReadAll(const std::string& filename)
return stream.str();
}
+/**
+ * @brief Tests if buildFile doesn't exist or is older than sourceFile
+ * @return True if buildFile doesn't exist or is older than sourceFile
+ */
+static bool FileAbsentOrOlder(const std::string& buildFile,
+ const std::string& sourceFile)
+{
+ int result = 0;
+ bool success =
+ cmsys::SystemTools::FileTimeCompare(buildFile, sourceFile, &result);
+ return (!success || (result <= 0));
+}
+
static bool ListContains(const std::vector<std::string>& list,
const std::string& entry)
{
return (std::find(list.begin(), list.end(), entry) != list.end());
}
-cmQtAutoGenerators::cmQtAutoGenerators()
- : Verbose(cmsys::SystemTools::HasEnv("VERBOSE"))
- , ColorOutput(true)
- , RunMocFailed(false)
- , RunUicFailed(false)
- , RunRccFailed(false)
- , GenerateAll(false)
+static std::string JoinOptions(const std::map<std::string, std::string>& opts)
{
-
- std::string colorEnv;
- cmsys::SystemTools::GetEnv("COLOR", colorEnv);
- if (!colorEnv.empty()) {
- if (cmSystemTools::IsOn(colorEnv.c_str())) {
- this->ColorOutput = true;
- } else {
- this->ColorOutput = false;
+ std::string result;
+ for (std::map<std::string, std::string>::const_iterator it = opts.begin();
+ it != opts.end(); ++it) {
+ if (it != opts.begin()) {
+ result += "%%%";
}
+ result += it->first;
+ result += "===";
+ result += it->second;
}
+ return result;
+}
- // Precompile regular expressions
- this->RegExpQObject.compile("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]");
- this->RegExpQGadget.compile("[\n][ \t]*Q_GADGET[^a-zA-Z0-9_]");
- this->RegExpMocInclude.compile(
- "[\n][ \t]*#[ \t]*include[ \t]+"
- "[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]");
- this->RegExpUicInclude.compile("[\n][ \t]*#[ \t]*include[ \t]+"
- "[\"<](([^ \">]+/)?ui_[^ \">/]+\\.h)[\">]");
+static std::string JoinExts(const std::vector<std::string>& lst)
+{
+ std::string result;
+ if (!lst.empty()) {
+ const std::string separator = ",";
+ for (std::vector<std::string>::const_iterator it = lst.begin();
+ it != lst.end(); ++it) {
+ if (it != lst.begin()) {
+ result += separator;
+ }
+ result += '.';
+ result += *it;
+ }
+ }
+ return result;
}
-void cmQtAutoGenerators::MergeUicOptions(
- std::vector<std::string>& opts, const std::vector<std::string>& fileOpts,
- bool isQt5)
+static void UicMergeOptions(std::vector<std::string>& opts,
+ const std::vector<std::string>& fileOpts,
+ bool isQt5)
{
static const char* valueOptions[] = { "tr", "translate",
"postfix", "generator",
@@ -158,6 +206,39 @@ void cmQtAutoGenerators::MergeUicOptions(
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
}
+// -- Class methods
+
+cmQtAutoGenerators::cmQtAutoGenerators()
+ : Verbose(cmsys::SystemTools::HasEnv("VERBOSE"))
+ , ColorOutput(true)
+ , RunMocFailed(false)
+ , RunUicFailed(false)
+ , RunRccFailed(false)
+ , GenerateMocAll(false)
+ , GenerateUicAll(false)
+ , GenerateRccAll(false)
+{
+
+ std::string colorEnv;
+ cmsys::SystemTools::GetEnv("COLOR", colorEnv);
+ if (!colorEnv.empty()) {
+ if (cmSystemTools::IsOn(colorEnv.c_str())) {
+ this->ColorOutput = true;
+ } else {
+ this->ColorOutput = false;
+ }
+ }
+
+ // Precompile regular expressions
+ this->RegExpQObject.compile("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]");
+ this->RegExpQGadget.compile("[\n][ \t]*Q_GADGET[^a-zA-Z0-9_]");
+ this->RegExpMocInclude.compile(
+ "[\n][ \t]*#[ \t]*include[ \t]+"
+ "[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]");
+ this->RegExpUicInclude.compile("[\n][ \t]*#[ \t]*include[ \t]+"
+ "[\"<](([^ \">]+/)?ui_[^ \">/]+\\.h)[\">]");
+}
+
bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
const std::string& config)
{
@@ -177,15 +258,20 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
if (!this->ReadAutogenInfoFile(mf.get(), targetDirectory, config)) {
return false;
}
- this->ReadOldMocDefinitionsFile(mf.get(), targetDirectory);
+ // Read old settings
+ this->OldSettingsReadFile(mf.get(), targetDirectory);
+ // Init and run
this->Init();
-
if (this->QtMajorVersion == "4" || this->QtMajorVersion == "5") {
if (!this->RunAutogen(mf.get())) {
return false;
}
}
- return this->WriteOldMocDefinitionsFile(targetDirectory);
+ // Write latest settings
+ if (!this->OldSettingsWriteFile(targetDirectory)) {
+ return false;
+ }
+ return true;
}
bool cmQtAutoGenerators::ReadAutogenInfoFile(
@@ -235,55 +321,30 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
// - Moc
cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition("AM_SKIP_MOC"),
this->SkipMoc);
- {
- std::string compileDefsPropOrig = "AM_MOC_COMPILE_DEFINITIONS";
- std::string compileDefsProp = compileDefsPropOrig;
- if (!config.empty()) {
- compileDefsProp += "_";
- compileDefsProp += config;
- }
- const char* compileDefs = makefile->GetDefinition(compileDefsProp);
- this->MocCompileDefinitionsStr = compileDefs
- ? compileDefs
- : makefile->GetSafeDefinition(compileDefsPropOrig);
- }
- {
- std::string includesPropOrig = "AM_MOC_INCLUDES";
- std::string includesProp = includesPropOrig;
- if (!config.empty()) {
- includesProp += "_";
- includesProp += config;
- }
- const char* includes = makefile->GetDefinition(includesProp);
- this->MocIncludesStr =
- includes ? includes : makefile->GetSafeDefinition(includesPropOrig);
- }
+ this->MocCompileDefinitionsStr =
+ GetConfigDefinition(makefile, "AM_MOC_COMPILE_DEFINITIONS", config);
+ this->MocIncludesStr =
+ GetConfigDefinition(makefile, "AM_MOC_INCLUDES", config);
this->MocOptionsStr = makefile->GetSafeDefinition("AM_MOC_OPTIONS");
// - Uic
cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition("AM_SKIP_UIC"),
this->SkipUic);
+ cmSystemTools::ExpandListArgument(
+ GetConfigDefinition(makefile, "AM_UIC_TARGET_OPTIONS", config),
+ this->UicTargetOptions);
{
- const char* uicOptionsFiles =
- makefile->GetSafeDefinition("AM_UIC_OPTIONS_FILES");
- std::string uicOptionsPropOrig = "AM_UIC_TARGET_OPTIONS";
- std::string uicOptionsProp = uicOptionsPropOrig;
- if (!config.empty()) {
- uicOptionsProp += "_";
- uicOptionsProp += config;
- }
- const char* uicTargetOptions = makefile->GetSafeDefinition(uicOptionsProp);
- cmSystemTools::ExpandListArgument(
- uicTargetOptions ? uicTargetOptions
- : makefile->GetSafeDefinition(uicOptionsPropOrig),
- this->UicTargetOptions);
- const char* uicOptionsOptions =
- makefile->GetSafeDefinition("AM_UIC_OPTIONS_OPTIONS");
std::vector<std::string> uicFilesVec;
- cmSystemTools::ExpandListArgument(uicOptionsFiles, uicFilesVec);
std::vector<std::string> uicOptionsVec;
- cmSystemTools::ExpandListArgument(uicOptionsOptions, uicOptionsVec);
+ cmSystemTools::ExpandListArgument(
+ makefile->GetSafeDefinition("AM_UIC_OPTIONS_FILES"), uicFilesVec);
+ cmSystemTools::ExpandListArgument(
+ makefile->GetSafeDefinition("AM_UIC_OPTIONS_OPTIONS"), uicOptionsVec);
if (uicFilesVec.size() != uicOptionsVec.size()) {
+ std::ostringstream err;
+ err << "AutoGen: Error: Uic files/options lists size missmatch in: "
+ << filename << std::endl;
+ this->LogError(err.str());
return false;
}
for (std::vector<std::string>::iterator fileIt = uicFilesVec.begin(),
@@ -295,20 +356,20 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
}
// - Rcc
+ cmSystemTools::ExpandListArgument(
+ makefile->GetSafeDefinition("AM_RCC_SOURCES"), this->RccSources);
{
- std::string rccSources = makefile->GetSafeDefinition("AM_RCC_SOURCES");
- cmSystemTools::ExpandListArgument(rccSources, this->RccSources);
- }
- {
- const char* rccOptionsFiles =
- makefile->GetSafeDefinition("AM_RCC_OPTIONS_FILES");
- const char* rccOptionsOptions =
- makefile->GetSafeDefinition("AM_RCC_OPTIONS_OPTIONS");
std::vector<std::string> rccFilesVec;
- cmSystemTools::ExpandListArgument(rccOptionsFiles, rccFilesVec);
std::vector<std::string> rccOptionsVec;
- cmSystemTools::ExpandListArgument(rccOptionsOptions, rccOptionsVec);
+ cmSystemTools::ExpandListArgument(
+ makefile->GetSafeDefinition("AM_RCC_OPTIONS_FILES"), rccFilesVec);
+ cmSystemTools::ExpandListArgument(
+ makefile->GetSafeDefinition("AM_RCC_OPTIONS_OPTIONS"), rccOptionsVec);
if (rccFilesVec.size() != rccOptionsVec.size()) {
+ std::ostringstream err;
+ err << "AutoGen: Error: RCC files/options lists size missmatch in: "
+ << filename << std::endl;
+ this->LogError(err.str());
return false;
}
for (std::vector<std::string>::iterator fileIt = rccFilesVec.begin(),
@@ -317,10 +378,11 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
cmSystemTools::ReplaceString(*optionIt, "@list_sep@", ";");
this->RccOptions[*fileIt] = *optionIt;
}
-
- const char* rccInputs = makefile->GetSafeDefinition("AM_RCC_INPUTS");
+ }
+ {
std::vector<std::string> rccInputLists;
- cmSystemTools::ExpandListArgument(rccInputs, rccInputLists);
+ cmSystemTools::ExpandListArgument(
+ makefile->GetSafeDefinition("AM_RCC_INPUTS"), rccInputLists);
// qrc files in the end of the list may have been empty
if (rccInputLists.size() < this->RccSources.size()) {
@@ -328,26 +390,21 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
}
if (this->RccSources.size() != rccInputLists.size()) {
std::ostringstream err;
- err << "AutoGen: RCC sources lists size missmatch in: " << filename;
- err << std::endl;
+ err << "AutoGen: Error: RCC sources/inputs lists size missmatch in: "
+ << filename << std::endl;
this->LogError(err.str());
return false;
}
-
for (std::vector<std::string>::iterator fileIt = this->RccSources.begin(),
inputIt = rccInputLists.begin();
fileIt != this->RccSources.end(); ++fileIt, ++inputIt) {
cmSystemTools::ReplaceString(*inputIt, "@list_sep@", ";");
std::vector<std::string> rccInputFiles;
cmSystemTools::ExpandListArgument(*inputIt, rccInputFiles);
-
this->RccInputs[*fileIt] = rccInputFiles;
}
}
- // - Settings
- this->CurrentCompileSettingsStr = this->MakeCompileSettingsString(makefile);
-
// - Flags
this->IncludeProjectDirsBefore =
makefile->IsOn("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE");
@@ -356,58 +413,124 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
return true;
}
-std::string cmQtAutoGenerators::MakeCompileSettingsString(cmMakefile* makefile)
+std::string cmQtAutoGenerators::MocSettingsStringCompose()
{
- std::string s;
- s += makefile->GetSafeDefinition("AM_MOC_COMPILE_DEFINITIONS");
- s += " ~~~ ";
- s += makefile->GetSafeDefinition("AM_MOC_INCLUDES");
- s += " ~~~ ";
- s += makefile->GetSafeDefinition("AM_MOC_OPTIONS");
- s += " ~~~ ";
- s += makefile->IsOn("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE") ? "TRUE"
- : "FALSE";
- s += " ~~~ ";
-
- return s;
+ std::string res;
+ res += this->MocCompileDefinitionsStr;
+ res += " ~~~ ";
+ res += this->MocIncludesStr;
+ res += " ~~~ ";
+ res += this->MocOptionsStr;
+ res += " ~~~ ";
+ res += this->IncludeProjectDirsBefore ? "TRUE" : "FALSE";
+ res += " ~~~ ";
+ return res;
}
-void cmQtAutoGenerators::ReadOldMocDefinitionsFile(
- cmMakefile* makefile, const std::string& targetDirectory)
+std::string cmQtAutoGenerators::UicSettingsStringCompose()
{
- std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
- cmSystemTools::ConvertToUnixSlashes(filename);
- filename += "/AutomocOldMocDefinitions.cmake";
+ std::string res;
+ res += cmJoin(this->UicTargetOptions, "@osep@");
+ res += " ~~~ ";
+ res += JoinOptions(this->UicOptions);
+ res += " ~~~ ";
+ return res;
+}
+
+std::string cmQtAutoGenerators::RccSettingsStringCompose()
+{
+ std::string res;
+ res += JoinOptions(this->RccOptions);
+ res += " ~~~ ";
+ return res;
+}
- if (makefile->ReadListFile(filename.c_str())) {
- this->OldCompileSettingsStr =
- makefile->GetSafeDefinition("AM_OLD_COMPILE_SETTINGS");
+void cmQtAutoGenerators::OldSettingsReadFile(
+ cmMakefile* makefile, const std::string& targetDirectory)
+{
+ if (!this->MocExecutable.empty() || !this->UicExecutable.empty() ||
+ !this->RccExecutable.empty()) {
+ // Compose current settings strings
+ this->MocSettingsString = this->MocSettingsStringCompose();
+ this->UicSettingsString = this->UicSettingsStringCompose();
+ this->RccSettingsString = this->RccSettingsStringCompose();
+
+ // Read old settings
+ const std::string filename = OldSettingsFile(targetDirectory);
+ if (makefile->ReadListFile(filename.c_str())) {
+ if (!this->MocExecutable.empty()) {
+ const std::string sol = makefile->GetSafeDefinition(MocOldSettingsKey);
+ if (sol != this->MocSettingsString) {
+ this->GenerateMocAll = true;
+ }
+ }
+ if (!this->UicExecutable.empty()) {
+ const std::string sol = makefile->GetSafeDefinition(UicOldSettingsKey);
+ if (sol != this->UicSettingsString) {
+ this->GenerateUicAll = true;
+ }
+ }
+ if (!this->RccExecutable.empty()) {
+ const std::string sol = makefile->GetSafeDefinition(RccOldSettingsKey);
+ if (sol != this->RccSettingsString) {
+ this->GenerateRccAll = true;
+ }
+ }
+ // In case any setting changed remove the old settings file.
+ // This triggers a full rebuild on the next run if the current
+ // build is aborted before writing the current settings in the end.
+ if (this->GenerateMocAll || this->GenerateUicAll ||
+ this->GenerateRccAll) {
+ cmSystemTools::RemoveFile(filename);
+ }
+ } else {
+ // If the file could not be read re-generate everythiung.
+ this->GenerateMocAll = true;
+ this->GenerateUicAll = true;
+ this->GenerateRccAll = true;
+ }
}
}
-bool cmQtAutoGenerators::WriteOldMocDefinitionsFile(
+bool cmQtAutoGenerators::OldSettingsWriteFile(
const std::string& targetDirectory)
{
bool success = true;
-
- std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
- cmSystemTools::ConvertToUnixSlashes(filename);
- filename += "/AutomocOldMocDefinitions.cmake";
-
- {
+ // Only write if any setting changed
+ if (this->GenerateMocAll || this->GenerateUicAll || this->GenerateRccAll) {
+ const std::string filename = OldSettingsFile(targetDirectory);
cmsys::ofstream outfile;
outfile.open(filename.c_str(), std::ios::trunc);
if (outfile) {
- outfile << "set(AM_OLD_COMPILE_SETTINGS "
- << cmOutputConverter::EscapeForCMake(
- this->CurrentCompileSettingsStr)
- << ")\n";
+ if (!this->MocExecutable.empty()) {
+ outfile << "set(" << MocOldSettingsKey << " "
+ << cmOutputConverter::EscapeForCMake(this->MocSettingsString)
+ << ")\n";
+ }
+ if (!this->UicExecutable.empty()) {
+ outfile << "set(" << UicOldSettingsKey << " "
+ << cmOutputConverter::EscapeForCMake(this->UicSettingsString)
+ << ")\n";
+ }
+ if (!this->RccExecutable.empty()) {
+ outfile << "set(" << RccOldSettingsKey << " "
+ << cmOutputConverter::EscapeForCMake(this->RccSettingsString)
+ << ")\n";
+ }
success = outfile.good();
+ outfile.close();
} else {
success = false;
+ // Remove old settings file to trigger full rebuild on next run
+ cmSystemTools::RemoveFile(filename);
+ {
+ std::ostringstream err;
+ err << "AutoGen: Error: Writing old settings file failed: " << filename
+ << std::endl;
+ this->LogError(err.str());
+ }
}
}
-
return success;
}
@@ -462,7 +585,6 @@ void cmQtAutoGenerators::Init()
if (this->IncludeProjectDirsBefore) {
const std::string binDir = "-I" + this->ProjectBinaryDir;
-
const std::string srcDir = "-I" + this->ProjectSourceDir;
std::list<std::string> sortedMocIncludes;
@@ -493,11 +615,6 @@ void cmQtAutoGenerators::Init()
bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
{
- // If settings changed everything needs to be re-generated.
- if (this->OldCompileSettingsStr != this->CurrentCompileSettingsStr) {
- this->GenerateAll = true;
- }
-
// the program goes through all .cpp files to see which moc files are
// included. It is not really interesting how the moc file is named, but
// what file the moc is created from. Once a moc is included the same moc
@@ -548,22 +665,70 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
notIncludedMocs, includedUis);
// Generate files
- if (!this->MocExecutable.empty()) {
- if (!this->GenerateMocFiles(includedMocs, notIncludedMocs)) {
- return false;
+ if (!this->MocGenerateAll(includedMocs, notIncludedMocs)) {
+ return false;
+ }
+ if (!this->UicGenerateAll(includedUis)) {
+ return false;
+ }
+ if (!this->QrcGenerateAll()) {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * @brief Tests if the C++ content requires moc processing
+ * @return True if moc is required
+ */
+bool cmQtAutoGenerators::MocRequired(const std::string& text,
+ std::string& macroName)
+{
+ // Run a simple check before an expensive regular expression check
+ if (strstr(text.c_str(), "Q_OBJECT") != CM_NULLPTR) {
+ if (this->RegExpQObject.find(text)) {
+ macroName = "Q_OBJECT";
+ return true;
}
}
- if (!this->UicExecutable.empty()) {
- if (!this->GenerateUiFiles(includedUis)) {
- return false;
+ if (strstr(text.c_str(), "Q_GADGET") != CM_NULLPTR) {
+ if (this->RegExpQGadget.find(text)) {
+ macroName = "Q_GADGET";
+ return true;
}
}
- if (!this->RccExecutable.empty()) {
- if (!this->GenerateQrcFiles()) {
+ return false;
+}
+
+/**
+ * @brief Tests if the file should be ignored for moc scanning
+ * @return True if the file should be ignored
+ */
+bool cmQtAutoGenerators::MocSkipTest(const std::string& absFilename)
+{
+ // Test if moc scanning is enabled
+ if (!this->MocExecutable.empty()) {
+ // Test if the file name is on the skip list
+ if (!ListContains(this->SkipMoc, absFilename)) {
return false;
}
}
+ return true;
+}
+/**
+ * @brief Tests if the file name is in the skip list
+ */
+bool cmQtAutoGenerators::UicSkipTest(const std::string& absFilename)
+{
+ // Test if uic scanning is enabled
+ if (!this->UicExecutable.empty()) {
+ // Test if the file name is on the skip list
+ if (!ListContains(this->SkipUic, absFilename)) {
+ return false;
+ }
+ }
return true;
}
@@ -597,25 +762,6 @@ bool cmQtAutoGenerators::ParseSourceFile(
return success;
}
-bool cmQtAutoGenerators::requiresMocing(const std::string& text,
- std::string& macroName)
-{
- // Run a simple check before an expensive regular expression check
- if (strstr(text.c_str(), "Q_OBJECT") != CM_NULLPTR) {
- if (this->RegExpQObject.find(text)) {
- macroName = "Q_OBJECT";
- return true;
- }
- }
- if (strstr(text.c_str(), "Q_GADGET") != CM_NULLPTR) {
- if (this->RegExpQGadget.find(text)) {
- macroName = "Q_GADGET";
- return true;
- }
- }
- return false;
-}
-
void cmQtAutoGenerators::ParseContentForUic(
const std::string& absFilename, const std::string& contentsString,
std::map<std::string, std::vector<std::string> >& includedUis)
@@ -665,7 +811,7 @@ bool cmQtAutoGenerators::ParseContentForMoc(
cmsys::SystemTools::GetFilenameWithoutLastExtension(absFilename);
std::string macroName;
- const bool requiresMoc = this->requiresMocing(contentsString, macroName);
+ const bool requiresMoc = this->MocRequired(contentsString, macroName);
bool ownDotMocIncluded = false;
bool ownMocUnderscoreIncluded = false;
std::string ownMocUnderscoreFile;
@@ -694,8 +840,8 @@ bool cmQtAutoGenerators::ParseContentForMoc(
// finding the correct header, so we need to remove the moc_ part
basename = basename.substr(4);
const std::string mocSubDir =
- extractSubDir(scannedFileAbsPath, currentMoc);
- const std::string headerToMoc = findMatchingHeader(
+ ExtractSubDir(scannedFileAbsPath, currentMoc);
+ const std::string headerToMoc = FindMatchingHeader(
scannedFileAbsPath, mocSubDir, basename, headerExtensions);
if (!headerToMoc.empty()) {
@@ -710,7 +856,7 @@ bool cmQtAutoGenerators::ParseContentForMoc(
err << "AutoMoc: Error: " << absFilename << "\n"
<< "The file includes the moc file \"" << currentMoc
<< "\", but could not find header \"" << basename << '{'
- << this->JoinExts(headerExtensions) << "}\" ";
+ << JoinExts(headerExtensions) << "}\" ";
if (mocSubDir.empty()) {
err << "in " << scannedFileAbsPath << "\n";
} else {
@@ -727,8 +873,8 @@ bool cmQtAutoGenerators::ParseContentForMoc(
// Mode: Relaxed
if (!requiresMoc || basename != scannedFileBasename) {
const std::string mocSubDir =
- extractSubDir(scannedFileAbsPath, currentMoc);
- const std::string headerToMoc = findMatchingHeader(
+ ExtractSubDir(scannedFileAbsPath, currentMoc);
+ const std::string headerToMoc = FindMatchingHeader(
scannedFileAbsPath, mocSubDir, basename, headerExtensions);
if (!headerToMoc.empty()) {
// This is for KDE4 compatibility:
@@ -771,7 +917,11 @@ bool cmQtAutoGenerators::ParseContentForMoc(
}
} else {
// Mode: Strict
- if (basename != scannedFileBasename) {
+ if (basename == scannedFileBasename) {
+ // Include self
+ fileToMoc = absFilename;
+ ownDotMocIncluded = true;
+ } else {
// Don't allow FOO.moc include other than self in strict mode
std::ostringstream err;
err << "AutoMoc: Error: " << absFilename << "\n"
@@ -782,10 +932,6 @@ bool cmQtAutoGenerators::ParseContentForMoc(
<< ".moc\" to run moc on this source file.\n";
this->LogError(err.str());
return false;
- } else {
- // Include self
- fileToMoc = absFilename;
- ownDotMocIncluded = true;
}
}
if (!fileToMoc.empty()) {
@@ -906,7 +1052,7 @@ void cmQtAutoGenerators::ParseHeaders(
this->LogInfo(err.str());
}
std::string macroName;
- if (this->requiresMocing(contents, macroName)) {
+ if (this->MocRequired(contents, macroName)) {
notIncludedMocs[headerName] = fpathCheckSum.getPart(headerName) +
"/moc_" +
cmsys::SystemTools::GetFilenameWithoutLastExtension(headerName) +
@@ -921,10 +1067,14 @@ void cmQtAutoGenerators::ParseHeaders(
}
}
-bool cmQtAutoGenerators::GenerateMocFiles(
+bool cmQtAutoGenerators::MocGenerateAll(
const std::map<std::string, std::string>& includedMocs,
const std::map<std::string, std::string>& notIncludedMocs)
{
+ if (this->MocExecutable.empty()) {
+ return true;
+ }
+
// look for name collisions
{
std::multimap<std::string, std::string> collisions;
@@ -951,7 +1101,7 @@ bool cmQtAutoGenerators::GenerateMocFiles(
for (std::map<std::string, std::string>::const_iterator it =
includedMocs.begin();
it != includedMocs.end(); ++it) {
- if (!this->GenerateMoc(it->first, it->second, subDirPrefix)) {
+ if (!this->MocGenerateFile(it->first, it->second, subDirPrefix)) {
if (this->RunMocFailed) {
return false;
}
@@ -966,7 +1116,7 @@ bool cmQtAutoGenerators::GenerateMocFiles(
for (std::map<std::string, std::string>::const_iterator it =
notIncludedMocs.begin();
it != notIncludedMocs.end(); ++it) {
- if (this->GenerateMoc(it->first, it->second, subDirPrefix)) {
+ if (this->MocGenerateFile(it->first, it->second, subDirPrefix)) {
automocCppChanged = true;
} else {
if (this->RunMocFailed) {
@@ -1045,17 +1195,20 @@ bool cmQtAutoGenerators::GenerateMocFiles(
/**
* @return True if a moc file was created. False may indicate an error.
*/
-bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
- const std::string& mocFileName,
- const std::string& subDirPrefix)
+bool cmQtAutoGenerators::MocGenerateFile(const std::string& sourceFile,
+ const std::string& mocFileName,
+ const std::string& subDirPrefix)
{
const std::string mocFileRel =
this->AutogenBuildSubDir + subDirPrefix + mocFileName;
const std::string mocFileAbs = this->CurrentBinaryDir + mocFileRel;
- int sourceNewerThanMoc = 0;
- bool success = cmsys::SystemTools::FileTimeCompare(sourceFile, mocFileAbs,
- &sourceNewerThanMoc);
- if (this->GenerateAll || !success || sourceNewerThanMoc >= 0) {
+
+ bool generateMoc = this->GenerateMocAll;
+ // Test if the source file is newer that the build file
+ if (!generateMoc) {
+ generateMoc = FileAbsentOrOlder(mocFileAbs, sourceFile);
+ }
+ if (generateMoc) {
// Log
this->LogBold("Generating MOC source " + mocFileRel);
@@ -1104,9 +1257,13 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
return false;
}
-bool cmQtAutoGenerators::GenerateUiFiles(
+bool cmQtAutoGenerators::UicGenerateAll(
const std::map<std::string, std::vector<std::string> >& includedUis)
{
+ if (this->UicExecutable.empty()) {
+ return true;
+ }
+
// single map with input / output names
std::map<std::string, std::map<std::string, std::string> > uiGenMap;
std::map<std::string, std::string> testMap;
@@ -1152,7 +1309,7 @@ bool cmQtAutoGenerators::GenerateUiFiles(
for (std::map<std::string, std::string>::const_iterator sit =
it->second.begin();
sit != it->second.end(); ++sit) {
- if (!this->GenerateUi(it->first, sit->first, sit->second)) {
+ if (!this->UicGenerateFile(it->first, sit->first, sit->second)) {
if (this->RunUicFailed) {
return false;
}
@@ -1166,18 +1323,20 @@ bool cmQtAutoGenerators::GenerateUiFiles(
/**
* @return True if a uic file was created. False may indicate an error.
*/
-bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
- const std::string& uiInputFile,
- const std::string& uiOutputFile)
+bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName,
+ const std::string& uiInputFile,
+ const std::string& uiOutputFile)
{
const std::string uicFileRel =
this->AutogenBuildSubDir + "include/" + uiOutputFile;
const std::string uicFileAbs = this->CurrentBinaryDir + uicFileRel;
- int sourceNewerThanUi = 0;
- bool success = cmsys::SystemTools::FileTimeCompare(uiInputFile, uicFileAbs,
- &sourceNewerThanUi);
- if (this->GenerateAll || !success || sourceNewerThanUi >= 0) {
+ bool generateUic = this->GenerateUicAll;
+ // Test if the source file is newer that the build file
+ if (!generateUic) {
+ generateUic = FileAbsentOrOlder(uicFileAbs, uiInputFile);
+ }
+ if (generateUic) {
// Log
this->LogBold("Generating UIC header " + uicFileRel);
@@ -1196,8 +1355,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
if (optionIt != this->UicOptions.end()) {
std::vector<std::string> fileOpts;
cmSystemTools::ExpandListArgument(optionIt->second, fileOpts);
- cmQtAutoGenerators::MergeUicOptions(opts, fileOpts,
- this->QtMajorVersion == "5");
+ UicMergeOptions(opts, fileOpts, this->QtMajorVersion == "5");
}
command.insert(command.end(), opts.begin(), opts.end());
@@ -1229,24 +1387,12 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
return false;
}
-bool cmQtAutoGenerators::InputFilesNewerThanQrc(const std::string& qrcFile,
- const std::string& rccOutput)
+bool cmQtAutoGenerators::QrcGenerateAll()
{
- std::vector<std::string> const& files = this->RccInputs[qrcFile];
- for (std::vector<std::string>::const_iterator it = files.begin();
- it != files.end(); ++it) {
- int inputNewerThanQrc = 0;
- bool success =
- cmsys::SystemTools::FileTimeCompare(*it, rccOutput, &inputNewerThanQrc);
- if (!success || inputNewerThanQrc >= 0) {
- return true;
- }
+ if (this->RccExecutable.empty()) {
+ return true;
}
- return false;
-}
-bool cmQtAutoGenerators::GenerateQrcFiles()
-{
// generate single map with input / output names
std::map<std::string, std::string> qrcGenMap;
for (std::vector<std::string>::const_iterator si = this->RccSources.begin();
@@ -1278,7 +1424,7 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
qrcGenMap.begin();
si != qrcGenMap.end(); ++si) {
bool unique = FileNameIsUnique(si->first, qrcGenMap);
- if (!this->GenerateQrc(si->first, si->second, unique)) {
+ if (!this->QrcGenerateFile(si->first, si->second, unique)) {
if (this->RunRccFailed) {
return false;
}
@@ -1290,9 +1436,9 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
/**
* @return True if a rcc file was created. False may indicate an error.
*/
-bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
- const std::string& qrcOutputFile,
- bool unique_n)
+bool cmQtAutoGenerators::QrcGenerateFile(const std::string& qrcInputFile,
+ const std::string& qrcOutputFile,
+ bool unique_n)
{
std::string symbolName =
cmsys::SystemTools::GetFilenameWithoutLastExtension(qrcInputFile);
@@ -1306,14 +1452,23 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
const std::string qrcBuildFile = this->CurrentBinaryDir + qrcOutputFile;
- int sourceNewerThanQrc = 0;
- bool generateQrc = !cmsys::SystemTools::FileTimeCompare(
- qrcInputFile, qrcBuildFile, &sourceNewerThanQrc);
- generateQrc = generateQrc || (sourceNewerThanQrc >= 0);
- generateQrc =
- generateQrc || this->InputFilesNewerThanQrc(qrcInputFile, qrcBuildFile);
-
- if (this->GenerateAll || generateQrc) {
+ bool generateQrc = this->GenerateRccAll;
+ // Test if the resources list file is newer than build file
+ if (!generateQrc) {
+ generateQrc = FileAbsentOrOlder(qrcBuildFile, qrcInputFile);
+ }
+ // Test if any resource file is newer than the build file
+ if (!generateQrc) {
+ const std::vector<std::string>& files = this->RccInputs[qrcInputFile];
+ for (std::vector<std::string>::const_iterator it = files.begin();
+ it != files.end(); ++it) {
+ if (FileAbsentOrOlder(qrcBuildFile, *it)) {
+ generateQrc = true;
+ break;
+ }
+ }
+ }
+ if (generateQrc) {
{
std::string msg = "Generating RCC source ";
msg += qrcOutputFile;
@@ -1365,67 +1520,6 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
return false;
}
-/**
- * @brief Tests if the file should be ignored for moc scanning
- * @return True if the file should be ignored
- */
-bool cmQtAutoGenerators::MocSkipTest(const std::string& absFilename)
-{
- // Test if moc scanning is enabled
- if (!this->MocExecutable.empty()) {
- // Test if the file name is on the skip list
- if (!ListContains(this->SkipMoc, absFilename)) {
- return false;
- }
- }
- return true;
-}
-
-/**
- * @brief Tests if the file name is in the skip list
- */
-bool cmQtAutoGenerators::UicSkipTest(const std::string& absFilename)
-{
- // Test if uic scanning is enabled
- if (!this->UicExecutable.empty()) {
- // Test if the file name is on the skip list
- if (!ListContains(this->SkipUic, absFilename)) {
- return false;
- }
- }
- return true;
-}
-
-/**
- * @brief Collects name collisions as output/input pairs
- * @return True if there were collisions
- */
-bool cmQtAutoGenerators::NameCollisionTest(
- const std::map<std::string, std::string>& genFiles,
- std::multimap<std::string, std::string>& collisions)
-{
- typedef std::map<std::string, std::string>::const_iterator Iter;
- typedef std::map<std::string, std::string>::value_type VType;
- for (Iter ait = genFiles.begin(); ait != genFiles.end(); ++ait) {
- bool first_match(true);
- for (Iter bit = (++Iter(ait)); bit != genFiles.end(); ++bit) {
- if (ait->second == bit->second) {
- if (first_match) {
- if (collisions.find(ait->second) != collisions.end()) {
- // We already know of this collision from before
- break;
- }
- collisions.insert(VType(ait->second, ait->first));
- first_match = false;
- }
- collisions.insert(VType(bit->second, bit->first));
- }
- }
- }
-
- return !collisions.empty();
-}
-
void cmQtAutoGenerators::LogErrorNameCollision(
const std::string& message,
const std::multimap<std::string, std::string>& collisions)
@@ -1485,6 +1579,36 @@ void cmQtAutoGenerators::LogCommand(const std::vector<std::string>& command)
}
/**
+ * @brief Collects name collisions as output/input pairs
+ * @return True if there were collisions
+ */
+bool cmQtAutoGenerators::NameCollisionTest(
+ const std::map<std::string, std::string>& genFiles,
+ std::multimap<std::string, std::string>& collisions)
+{
+ typedef std::map<std::string, std::string>::const_iterator Iter;
+ typedef std::map<std::string, std::string>::value_type VType;
+ for (Iter ait = genFiles.begin(); ait != genFiles.end(); ++ait) {
+ bool first_match(true);
+ for (Iter bit = (++Iter(ait)); bit != genFiles.end(); ++bit) {
+ if (ait->second == bit->second) {
+ if (first_match) {
+ if (collisions.find(ait->second) != collisions.end()) {
+ // We already know of this collision from before
+ break;
+ }
+ collisions.insert(VType(ait->second, ait->first));
+ first_match = false;
+ }
+ collisions.insert(VType(bit->second, bit->first));
+ }
+ }
+ }
+
+ return !collisions.empty();
+}
+
+/**
* @brief Generates the parent directory of the given file on demand
* @return True on success
*/
@@ -1502,22 +1626,3 @@ bool cmQtAutoGenerators::MakeParentDirectory(const std::string& filename)
}
return success;
}
-
-std::string cmQtAutoGenerators::JoinExts(const std::vector<std::string>& lst)
-{
- if (lst.empty()) {
- return "";
- }
-
- std::string result;
- std::string separator = ",";
- for (std::vector<std::string>::const_iterator it = lst.begin();
- it != lst.end(); ++it) {
- if (it != lst.begin()) {
- result += separator;
- }
- result += '.' + (*it);
- }
- result.erase(result.end() - 1);
- return result;
-}
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index d0c7066..7891eb9 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -22,32 +22,26 @@ public:
bool Run(const std::string& targetDirectory, const std::string& config);
private:
+ // - Configuration
bool ReadAutogenInfoFile(cmMakefile* makefile,
const std::string& targetDirectory,
const std::string& config);
- void ReadOldMocDefinitionsFile(cmMakefile* makefile,
- const std::string& targetDirectory);
- bool WriteOldMocDefinitionsFile(const std::string& targetDirectory);
- std::string MakeCompileSettingsString(cmMakefile* makefile);
+ std::string MocSettingsStringCompose();
+ std::string UicSettingsStringCompose();
+ std::string RccSettingsStringCompose();
+ void OldSettingsReadFile(cmMakefile* makefile,
+ const std::string& targetDirectory);
+ bool OldSettingsWriteFile(const std::string& targetDirectory);
+ // - Init and run
+ void Init();
bool RunAutogen(cmMakefile* makefile);
- bool GenerateMocFiles(
- const std::map<std::string, std::string>& includedMocs,
- const std::map<std::string, std::string>& notIncludedMocs);
- bool GenerateMoc(const std::string& sourceFile,
- const std::string& mocFileName,
- const std::string& subDirPrefix);
-
- bool GenerateUiFiles(
- const std::map<std::string, std::vector<std::string> >& includedUis);
- bool GenerateUi(const std::string& realName, const std::string& uiInputFile,
- const std::string& uiOutputFile);
-
- bool GenerateQrcFiles();
- bool GenerateQrc(const std::string& qrcInputFile,
- const std::string& qrcOutputFile, bool unique_n);
+ // - Content analysis
+ bool MocRequired(const std::string& text, std::string& macroName);
+ bool MocSkipTest(const std::string& absFilename);
+ bool UicSkipTest(const std::string& absFilename);
bool ParseSourceFile(
const std::string& absFilename,
@@ -55,6 +49,7 @@ private:
std::map<std::string, std::string>& includedMocs,
std::map<std::string, std::vector<std::string> >& includedUis,
bool relaxed);
+
void SearchHeadersForSourceFile(
const std::string& absFilename,
const std::vector<std::string>& headerExtensions,
@@ -68,8 +63,6 @@ private:
std::map<std::string, std::string>& notIncludedMocs,
std::map<std::string, std::vector<std::string> >& includedUis);
- bool requiresMocing(const std::string& text, std::string& macroName);
-
void ParseContentForUic(
const std::string& fileName, const std::string& contentsString,
std::map<std::string, std::vector<std::string> >& includedUis);
@@ -80,18 +73,27 @@ private:
std::map<std::string, std::string>& includedMocs,
bool relaxed);
- void ParseForUic(
- const std::string& fileName,
- std::map<std::string, std::vector<std::string> >& includedUis);
-
- void Init();
+ // - Moc file generation
+ bool MocGenerateAll(
+ const std::map<std::string, std::string>& includedMocs,
+ const std::map<std::string, std::string>& notIncludedMocs);
+ bool MocGenerateFile(const std::string& sourceFile,
+ const std::string& mocFileName,
+ const std::string& subDirPrefix);
- bool MocSkipTest(const std::string& absFilename);
- bool UicSkipTest(const std::string& absFilename);
+ // - Uic file generation
+ bool UicGenerateAll(
+ const std::map<std::string, std::vector<std::string> >& includedUis);
+ bool UicGenerateFile(const std::string& realName,
+ const std::string& uiInputFile,
+ const std::string& uiOutputFile);
- bool NameCollisionTest(const std::map<std::string, std::string>& genFiles,
- std::multimap<std::string, std::string>& collisions);
+ // - Qrc file generation
+ bool QrcGenerateAll();
+ bool QrcGenerateFile(const std::string& qrcInputFile,
+ const std::string& qrcOutputFile, bool unique_n);
+ // - Logging
void LogErrorNameCollision(
const std::string& message,
const std::multimap<std::string, std::string>& collisions);
@@ -101,17 +103,11 @@ private:
void LogError(const std::string& message);
void LogCommand(const std::vector<std::string>& command);
+ // - Utility
+ bool NameCollisionTest(const std::map<std::string, std::string>& genFiles,
+ std::multimap<std::string, std::string>& collisions);
bool MakeParentDirectory(const std::string& filename);
- std::string JoinExts(const std::vector<std::string>& lst);
-
- static void MergeUicOptions(std::vector<std::string>& opts,
- const std::vector<std::string>& fileOpts,
- bool isQt5);
-
- bool InputFilesNewerThanQrc(const std::string& qrcFile,
- const std::string& rccOutput);
-
// - Target names
std::string OriginTargetName;
std::string AutogenTargetName;
@@ -139,17 +135,17 @@ private:
std::list<std::string> MocIncludes;
std::list<std::string> MocDefinitions;
std::vector<std::string> MocOptions;
+ std::string MocSettingsString;
// - Uic
std::vector<std::string> SkipUic;
std::vector<std::string> UicTargetOptions;
std::map<std::string, std::string> UicOptions;
+ std::string UicSettingsString;
// - Rcc
std::vector<std::string> RccSources;
std::map<std::string, std::string> RccOptions;
std::map<std::string, std::vector<std::string> > RccInputs;
- // - Settings
- std::string CurrentCompileSettingsStr;
- std::string OldCompileSettingsStr;
+ std::string RccSettingsString;
// - Utility
cmFilePathChecksum fpathCheckSum;
cmsys::RegularExpression RegExpQObject;
@@ -163,7 +159,9 @@ private:
bool RunMocFailed;
bool RunUicFailed;
bool RunRccFailed;
- bool GenerateAll;
+ bool GenerateMocAll;
+ bool GenerateUicAll;
+ bool GenerateRccAll;
bool MocRelaxedMode;
};
diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx
index d675a2c..c2ff664 100644
--- a/Source/cmVSSetupHelper.cxx
+++ b/Source/cmVSSetupHelper.cxx
@@ -73,42 +73,19 @@ cmVSSetupAPIHelper::~cmVSSetupAPIHelper()
bool cmVSSetupAPIHelper::IsVS2017Installed()
{
- bool ret = false;
- if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) {
- ret = EnumerateAndChooseVSInstance();
- }
-
- return ret;
+ return this->EnumerateAndChooseVSInstance();
}
bool cmVSSetupAPIHelper::IsWin10SDKInstalled()
{
- bool isWin10SDKInstalled = false;
- if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) {
- if (EnumerateAndChooseVSInstance() &&
- chosenInstanceInfo.VSInstallLocation.compare(L"") != 0) {
- isWin10SDKInstalled = chosenInstanceInfo.IsWin10SDKInstalled;
- }
- } else {
- isWin10SDKInstalled = chosenInstanceInfo.IsWin10SDKInstalled;
- }
-
- return isWin10SDKInstalled;
+ return (this->EnumerateAndChooseVSInstance() &&
+ chosenInstanceInfo.IsWin10SDKInstalled);
}
bool cmVSSetupAPIHelper::IsWin81SDKInstalled()
{
- bool isWin81SDKInstalled = false;
- if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) {
- if (EnumerateAndChooseVSInstance() &&
- chosenInstanceInfo.VSInstallLocation.compare(L"") != 0) {
- isWin81SDKInstalled = chosenInstanceInfo.IsWin81SDKInstalled;
- }
- } else {
- isWin81SDKInstalled = chosenInstanceInfo.IsWin81SDKInstalled;
- }
-
- return isWin81SDKInstalled;
+ return (this->EnumerateAndChooseVSInstance() &&
+ chosenInstanceInfo.IsWin81SDKInstalled);
}
bool cmVSSetupAPIHelper::CheckInstalledComponent(
@@ -241,18 +218,12 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo(
bool cmVSSetupAPIHelper::GetVSInstanceInfo(std::string& vsInstallLocation)
{
vsInstallLocation = "";
- bool isInstalled = false;
+ bool isInstalled = this->EnumerateAndChooseVSInstance();
- if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) {
- isInstalled = EnumerateAndChooseVSInstance();
- }
-
- // Enumerate and choose best VS instance
- if (chosenInstanceInfo.VSInstallLocation.compare(L"") != 0) {
+ if (isInstalled) {
std::string str(chosenInstanceInfo.VSInstallLocation.begin(),
chosenInstanceInfo.VSInstallLocation.end());
vsInstallLocation = str;
- isInstalled = true;
}
return isInstalled;
diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt
index 5772fcf..40c9675 100644
--- a/Tests/Cuda/CMakeLists.txt
+++ b/Tests/Cuda/CMakeLists.txt
@@ -2,3 +2,4 @@
ADD_TEST_MACRO(Cuda.Complex CudaComplex)
ADD_TEST_MACRO(Cuda.ConsumeCompileFeatures CudaConsumeCompileFeatures)
ADD_TEST_MACRO(Cuda.ObjectLibrary CudaObjectLibrary)
+ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags)
diff --git a/Tests/Cuda/ProperLinkFlags/CMakeLists.txt b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt
new file mode 100644
index 0000000..a9eb8bd
--- /dev/null
+++ b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt
@@ -0,0 +1,20 @@
+
+cmake_minimum_required(VERSION 3.7)
+project (ProperLinkFlags CUDA CXX)
+
+#Goal for this example:
+#Verify that when we have CXX and CUDA enabled and we link an executable that
+#has CUDA and CXX we use the CUDA link flags when doing the device link
+#step
+
+#Specify a set of valid CUDA flags and an invalid set of CXX flags ( for CUDA )
+#to make sure we don't use the CXX flags when linking CUDA executables
+set(CMAKE_CUDA_FLAGS "-arch=sm_35 --use_fast_math")
+set(CMAKE_CXX_FLAGS "-Wall")
+
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CUDA_STANDARD 11)
+add_executable(ProperLinkFlags file1.cu main.cxx)
+
+set_target_properties( ProperLinkFlags
+ PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
diff --git a/Tests/Cuda/ProperLinkFlags/file1.cu b/Tests/Cuda/ProperLinkFlags/file1.cu
new file mode 100644
index 0000000..d93dc9f
--- /dev/null
+++ b/Tests/Cuda/ProperLinkFlags/file1.cu
@@ -0,0 +1,11 @@
+
+#include "file1.h"
+
+result_type __device__ file1_func(int x)
+{
+ __ldg(&x);
+ result_type r;
+ r.input = x;
+ r.sum = x*x;
+ return r;
+}
diff --git a/Tests/Cuda/ProperLinkFlags/file1.h b/Tests/Cuda/ProperLinkFlags/file1.h
new file mode 100644
index 0000000..ff1945c
--- /dev/null
+++ b/Tests/Cuda/ProperLinkFlags/file1.h
@@ -0,0 +1,7 @@
+
+#pragma once
+struct result_type
+{
+ int input;
+ int sum;
+};
diff --git a/Tests/Cuda/ProperLinkFlags/main.cxx b/Tests/Cuda/ProperLinkFlags/main.cxx
new file mode 100644
index 0000000..7c0ee9e
--- /dev/null
+++ b/Tests/Cuda/ProperLinkFlags/main.cxx
@@ -0,0 +1,9 @@
+
+#include <iostream>
+
+#include "file1.h"
+
+int main(int argc, char** argv)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake
index 4654416..ecb9a64 100644
--- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake
@@ -12,4 +12,6 @@ add_test(NAME test1
set_tests_properties(test1 PROPERTIES DEPENDS "initialization")
add_test(hello ${CMAKE_COMMAND} -E echo hello)
+set_tests_properties(hello PROPERTIES FAIL_REGULAR_EXPRESSION "hello.*hello")
+
add_test(goodbye ${CMAKE_COMMAND} -E echo goodbye)