New upstream version 3.18.4

ci/unstable
Felix Geyer 4 years ago
parent 0b396e2089
commit e0ffb2c2a7

@ -178,17 +178,15 @@ Modules
Autogen
-------
* When using :prop_tgt:`AUTOMOC`, CMake now generates the ``-p`` path prefix
* When using :prop_tgt:`AUTOMOC`, the new :variable:`CMAKE_AUTOMOC_PATH_PREFIX`
variable or :prop_tgt:`AUTOMOC_PATH_PREFIX` target property may be enabled
to generate the ``-p`` path prefix
option for ``moc``. This ensures that ``moc`` output files are identical
on different build setups (given, that the headers compiled by ``moc`` are
in an :command:`include directory <target_include_directories>`).
Also it ensures that ``moc`` output files will compile correctly when the
source and/or build directory is a symbolic link.
The ``moc`` path prefix generation behavior can be configured by setting
the new :variable:`CMAKE_AUTOMOC_PATH_PREFIX` variable and/or
:prop_tgt:`AUTOMOC_PATH_PREFIX` target property.
CTest
-----
@ -316,3 +314,11 @@ Changes made since CMake 3.16.0 include the following.
:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target properties.
Previously they would be places in ``*_CFLAGS_OTHER`` variables and
:prop_tgt:`INTERFACE_COMPILE_OPTIONS` target properties.
3.16.9
------
* The default value of :variable:`CMAKE_AUTOMOC_PATH_PREFIX` was changed to
``OFF`` because this feature can break existing projects that have
identically named header files in different include directories.
This restores compatibility with behavior of CMake 3.15 and below.

@ -346,3 +346,12 @@ Changes made since CMake 3.17.0 include the following.
:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target properties.
Previously they would be places in ``*_CFLAGS_OTHER`` variables and
:prop_tgt:`INTERFACE_COMPILE_OPTIONS` target properties.
3.17.5
------
* The default value of :variable:`CMAKE_AUTOMOC_PATH_PREFIX` was changed to
``OFF`` because this feature can break existing projects that have
identically named header files in different include directories.
This restores compatibility with behavior of CMake 3.15 and below.
The default was also changed to ``OFF`` in 3.16.9.

@ -265,8 +265,9 @@ Other
environment variable to customize colors.
* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
is now aware of the availability of C11 features in MSVC 19.27 and above,
including support for the ``c_restrict`` feature and the ``-std:c11`` flag.
is now aware of the availability of C11 features in MSVC 19.27 and 19.28,
including support for the ``c_restrict``, ``c_static_assert`` features and
the ``-std:c11`` flag.
Deprecated and Removed Features
===============================
@ -351,6 +352,13 @@ Changes made since CMake 3.18.0 include the following.
``OFF`` because this feature can break existing projects that have
identically named header files in different include directories.
This restores compatibility with behavior of CMake 3.15 and below.
The default was also changed to ``OFF`` in 3.16.9 and 3.17.5.
* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
was updated for MSVC 19.27 as mentioned above.
was updated for MSVC 19.27 as mentioned above (``c_restrict``).
3.18.3
------
* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
was updated for MSVC 19.28 as mentioned above (``c_static_assert``).

@ -72,10 +72,11 @@ if(("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC" AND
if("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xClang")
find_program(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm llvm-nm HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
set(_CMAKE_ADDITIONAL_LINKER_NAMES "lld-link")
set(_CMAKE_ADDITIONAL_AR_NAMES "llvm-lib")
endif()
find_program(CMAKE_LINKER NAMES ${_CMAKE_ADDITIONAL_LINKER_NAMES} link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(CMAKE_AR NAMES lib HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(CMAKE_AR NAMES ${_CMAKE_ADDITIONAL_AR_NAMES} lib HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(CMAKE_MT NAMES mt HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
list(APPEND _CMAKE_TOOL_VARS LINKER MT)

@ -170,7 +170,7 @@ endif()
# compile an Objective-C file into an object file
if(NOT CMAKE_OBJC_COMPILE_OBJECT)
set(CMAKE_OBJC_COMPILE_OBJECT
"<CMAKE_OBJC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x objective-c -o <OBJECT> -c <SOURCE>")
"<CMAKE_OBJC_COMPILER> <DEFINES> <INCLUDES> -x objective-c <FLAGS> -o <OBJECT> -c <SOURCE>")
endif()
if(NOT CMAKE_OBJC_LINK_EXECUTABLE)

@ -263,7 +263,7 @@ endif()
# compile an Objective-C++ file into an object file
if(NOT CMAKE_OBJCXX_COMPILE_OBJECT)
set(CMAKE_OBJCXX_COMPILE_OBJECT
"<CMAKE_OBJCXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x objective-c++ -o <OBJECT> -c <SOURCE>")
"<CMAKE_OBJCXX_COMPILER> <DEFINES> <INCLUDES> -x objective-c++ <FLAGS> -o <OBJECT> -c <SOURCE>")
endif()
if(NOT CMAKE_OBJCXX_LINK_EXECUTABLE)

@ -54,5 +54,4 @@ function(check_c_compiler_flag _flag _var)
foreach(v IN LISTS _locale_vars)
set(ENV{${v}} ${_locale_vars_saved_${v}})
endforeach()
set(${_var} "${${_var}}" PARENT_SCOPE)
endfunction()

@ -54,5 +54,4 @@ function(check_cxx_compiler_flag _flag _var)
foreach(v IN LISTS _locale_vars)
set(ENV{${v}} ${_locale_vars_saved_${v}})
endforeach()
set(${_var} "${${_var}}" PARENT_SCOPE)
endfunction()

@ -115,11 +115,12 @@ macro(__compiler_armclang lang)
endif()
if(__CMAKE_ARMClang_USING_armlink)
unset(CMAKE_${lang}_LINKER_WRAPPER_FLAG)
set(__CMAKE_ARMClang_USING_armlink_WRAPPER "")
else()
set(__CMAKE_ARMClang_USING_armlink_WRAPPER ${CMAKE_${lang}_LINKER_WRAPPER_FLAG})
set(__CMAKE_ARMClang_USING_armlink_WRAPPER "-Xlinker")
endif()
set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> ${__CMAKE_ARMClang_USING_armlink_WRAPPER} --list <TARGET_BASE>.map")
set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> ${__CMAKE_ARMClang_USING_armlink_WRAPPER} --list=<TARGET_BASE>.map")
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "${__CMAKE_ARMClang_USING_armlink_WRAPPER} --via=")

@ -10,6 +10,11 @@ set(__COMPILER_CLANG 1)
include(Compiler/CMakeCommonCompilerMacros)
set(__pch_header_C "c-header")
set(__pch_header_CXX "c++-header")
set(__pch_header_OBJC "objective-c-header")
set(__pch_header_OBJCXX "objective-c++-header")
if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC")
@ -102,7 +107,7 @@ else()
set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
endif()
set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE> -Xclang -include -Xclang <PCH_HEADER>)
set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER>)
set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER> -x ${__pch_header_${lang}})
endmacro()
endif()

@ -1,9 +1,7 @@
set(_cmake_oldestSupported "_MSC_VER >= 1600")
# Not yet supported:
#set(_cmake_feature_test_c_static_assert "")
set(_cmake_feature_test_c_restrict "_MSC_VER >= 1927")
set(_cmake_feature_test_c_static_assert "_MSC_VER >= 1928")
set(_cmake_feature_test_c_variadic_macros "${_cmake_oldestSupported}")
set(_cmake_feature_test_c_function_prototypes "${_cmake_oldestSupported}")

@ -51,6 +51,10 @@ macro(cmake_record_c_compile_features)
list(APPEND CMAKE_C_COMPILE_FEATURES c_restrict)
list(APPEND CMAKE_C99_COMPILE_FEATURES c_restrict)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.28)
list(APPEND CMAKE_C_COMPILE_FEATURES c_static_assert)
list(APPEND CMAKE_C11_COMPILE_FEATURES c_static_assert)
endif()
set(_result 0) # expected by cmake_determine_compile_features
endmacro()

@ -68,20 +68,22 @@ if(UNIX)
endif()
if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
# MSVC requires c++14 as the minimum level
set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "")
set(CMAKE_CUDA03_EXTENSION_COMPILE_OPTION "")
# MSVC requires c++14 as the minimum level
set(CMAKE_CUDA11_STANDARD_COMPILE_OPTION "")
set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "")
if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0)
set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "")
set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "")
set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14")
set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14")
endif()
if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11.0)
set(CMAKE_CUDA17_STANDARD_COMPILE_OPTION "")
set(CMAKE_CUDA17_EXTENSION_COMPILE_OPTION "")
set(CMAKE_CUDA17_STANDARD_COMPILE_OPTION "-std=c++17")
set(CMAKE_CUDA17_EXTENSION_COMPILE_OPTION "-std=c++17")
endif()
else()

@ -7,7 +7,7 @@
# ARCH_AND_PTX : NAME | NUM.NUM | NUM.NUM(NUM.NUM) | NUM.NUM+PTX
# NAME: Fermi Kepler Maxwell Kepler+Tegra Kepler+Tesla Maxwell+Tegra Pascal Volta Turing Ampere
# NUM: Any number. Only those pairs are currently accepted by NVCC though:
# 2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2 7.0 7.2 7.5 8.0
# 2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2 7.0 7.2 7.5 8.0 8.6
# Returns LIST of flags to be added to CUDA_NVCC_FLAGS in ${out_variable}
# Additionally, sets ${out_variable}_readable to the resulting numeric list
# Example:
@ -82,16 +82,26 @@ if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0")
list(APPEND CUDA_ALL_GPU_ARCHITECTURES "7.5")
if(CUDA_VERSION VERSION_LESS "11.0")
set(CUDA_LIMIT_GPU_ARCHITECTURE "8.0")
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "7.5+PTX")
set(CUDA_LIMIT_GPU_ARCHITECTURE "8.0")
endif()
endif()
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0")
list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Ampere")
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "8.0" "8.0+PTX")
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "8.0")
list(APPEND CUDA_ALL_GPU_ARCHITECTURES "8.0")
if(CUDA_VERSION VERSION_LESS "11.1")
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "8.0+PTX")
set(CUDA_LIMIT_GPU_ARCHITECTURE "8.6")
endif()
endif()
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1")
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "8.6" "8.6+PTX")
list(APPEND CUDA_ALL_GPU_ARCHITECTURES "8.6")
if(CUDA_VERSION VERSION_LESS "12.0")
set(CUDA_LIMIT_GPU_ARCHITECTURE "9.0")
endif()

@ -59,6 +59,8 @@ macro(java_append_library_directories _var)
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
set(_java_libarch "i386")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
set(_java_libarch "arm64" "aarch64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha")
set(_java_libarch "alpha")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")

@ -241,6 +241,7 @@ if(NOT MATLAB_ADDITIONAL_VERSIONS)
endif()
set(MATLAB_VERSIONS_MAPPING
"R2020b=9.9"
"R2020a=9.8"
"R2019b=9.7"
"R2019a=9.6"

@ -9,6 +9,9 @@
# Initial configuration
#
cmake_policy(PUSH)
# numbers and boolean constants
cmake_policy (SET CMP0012 NEW)
# IN_LIST operator
cmake_policy (SET CMP0057 NEW)
@ -44,7 +47,6 @@ macro (_PYTHON_DISPLAY_FAILURE _PYTHON_MSG)
set (${_PYTHON_PREFIX}_FOUND FALSE)
string (TOUPPER "${_PYTHON_PREFIX}" _${_PYTHON_PREFIX}_UPPER_PREFIX)
set (${_PYTHON_UPPER_PREFIX}_FOUND FALSE)
return()
endmacro()
@ -606,6 +608,15 @@ function (_PYTHON_GET_VERSION)
if (config MATCHES "#[ ]*define[ ]+MS_WIN32")
# ABI not used on Windows
set (abi "")
else()
if (NOT config)
# pyconfig.h can be a wrapper to a platform specific pyconfig.h
# In this case, try to identify ABI from include directory
if (_${_PYTHON_PREFIX}_INCLUDE_DIR MATCHES "python${version_major}\\.${version_minor}+([dmu]*)")
set (abi "${CMAKE_MATCH_1}")
else()
set (abi "")
endif()
else()
if (config MATCHES "#[ ]*define[ ]+Py_DEBUG[ ]+1")
string (APPEND abi "d")
@ -616,6 +627,7 @@ function (_PYTHON_GET_VERSION)
if (config MATCHES "#[ ]*define[ ]+Py_UNICODE_SIZE[ ]+4")
string (APPEND abi "u")
endif()
endif()
set (${_PGV_PREFIX}ABI "${abi}" PARENT_SCOPE)
endif()
else()
@ -1012,6 +1024,9 @@ endfunction()
if (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR
AND NOT ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
_python_display_failure ("Could NOT find ${_PYTHON_PREFIX}: Wrong major version specified is \"${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}\", but expected major version is \"${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}\"")
cmake_policy(POP)
return()
endif()
@ -2952,6 +2967,9 @@ endif()
if (${_PYTHON_PREFIX}_VERSION_MAJOR AND
NOT ${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
_python_display_failure ("Could NOT find ${_PYTHON_PREFIX}: Found unsuitable major version \"${${_PYTHON_PREFIX}_VERSION_MAJOR}\", but required major version is exact version \"${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}\"")
cmake_policy(POP)
return()
endif()
unset (_${_PYTHON_PREFIX}_REASON_FAILURE)
@ -3160,3 +3178,5 @@ if (DEFINED _${_PYTHON_PREFIX}_CMAKE_FIND_FRAMEWORK)
else()
unset (CMAKE_FIND_FRAMEWORK)
endif()
cmake_policy(POP)

@ -8,6 +8,11 @@ if(__WINDOWS_CLANG)
endif()
set(__WINDOWS_CLANG 1)
set(__pch_header_C "c-header")
set(__pch_header_CXX "c++-header")
set(__pch_header_OBJC "objective-c-header")
set(__pch_header_OBJCXX "objective-c++-header")
macro(__windows_compiler_clang_gnu lang)
set(CMAKE_LIBRARY_PATH_FLAG "-L")
set(CMAKE_LINK_LIBRARY_FLAG "-l")
@ -87,7 +92,7 @@ macro(__windows_compiler_clang_gnu lang)
set(CMAKE_PCH_EXTENSION .pch)
set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE> -Xclang -include -Xclang <PCH_HEADER>)
set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER>)
set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER> -x ${__pch_header_${lang}})
unset(__ADDED_FLAGS)
unset(__ADDED_FLAGS_DEBUG)

@ -10,6 +10,11 @@ set(__WINDOWS_EMBARCADERO 1)
set(BORLAND 1)
set(__pch_header_C "c-header")
set(__pch_header_CXX "c++-header")
set(__pch_header_OBJC "objective-c-header")
set(__pch_header_OBJCXX "objective-c++-header")
if("${CMAKE_${_lang}_COMPILER_VERSION}" VERSION_LESS 6.30)
# Borland target type flags (bcc32 -h -t):
set(_tW "-tW") # -tW GUI App (implies -U__CONSOLE__)
@ -123,7 +128,7 @@ macro(__embarcadero_language lang)
if (EMBARCADERO)
set(CMAKE_PCH_EXTENSION .pch)
set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE> -Xclang -include -Xclang <PCH_HEADER>)
set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER>)
set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER> -x ${__pch_header_${lang}})
endif()
# Initial configuration flags.

@ -496,7 +496,8 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
endif()
endif()
if (SWIG_MODULE_${name}_LANGUAGE STREQUAL "PYTHON" AND NOT SWIG_MODULE_${name}_NOPROXY)
if(NOT ("-interface" IN_LIST swig_source_file_flags OR "-interface" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS))
if(SWIG_USE_INTERFACE AND
NOT ("-interface" IN_LIST swig_source_file_flags OR "-interface" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS))
# This makes sure that the name used in the proxy code
# matches the library name created by CMake
list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-interface" "$<TARGET_FILE_PREFIX:${target_name}>$<TARGET_FILE_BASE_NAME:${target_name}>")
@ -724,6 +725,13 @@ function(SWIG_ADD_LIBRARY name)
set(swig_generated_sources)
set(swig_generated_timestamps)
list(LENGTH swig_dot_i_sources swig_sources_count)
if (swig_sources_count GREATER "1")
# option -interface cannot be used
set(SWIG_USE_INTERFACE FALSE)
else()
set(SWIG_USE_INTERFACE TRUE)
endif()
foreach(swig_it IN LISTS swig_dot_i_sources)
SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source "${swig_it}")
list (APPEND swig_generated_sources "${swig_generated_source}")

@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 18)
set(CMake_VERSION_PATCH 2)
set(CMake_VERSION_PATCH 4)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
@ -21,7 +21,7 @@ endif()
if(NOT CMake_VERSION_NO_GIT)
# If this source was exported by 'git archive', use its commit info.
set(git_info [==[aaa5eab410 CMake 3.18.2]==])
set(git_info [==[3cc3d42aba CMake 3.18.4]==])
# Otherwise, try to identify the current development source version.
if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* "

@ -365,6 +365,12 @@ bool TryParseInteger(cmExecutionStatus& status, const std::string& str, int& i)
status.SetError(e.str());
cmSystemTools::SetFatalErrorOccured();
return false;
} catch (std::out_of_range&) {
std::ostringstream e;
e << "Integer out of range: '" << str << "'";
status.SetError(e.str());
cmSystemTools::SetFatalErrorOccured();
return false;
}
return true;

@ -1611,6 +1611,8 @@ bool cmGlobalGenerator::AddAutomaticSources()
{
for (const auto& lg : this->LocalGenerators) {
lg->CreateEvaluationFileOutputs();
}
for (const auto& lg : this->LocalGenerators) {
for (const auto& gt : lg->GetGeneratorTargets()) {
if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
gt->GetType() == cmStateEnums::UTILITY ||

@ -1170,7 +1170,9 @@ void cmGlobalNinjaGenerator::AppendTargetDependsClosure(
for (auto const& dep_target : this->GetTargetDirectDepends(target)) {
if (dep_target->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
(this->EnableCrossConfigBuild() && !dep_target.IsCross())) {
(target->GetType() != cmStateEnums::UTILITY &&
dep_target->GetType() != cmStateEnums::UTILITY &&
this->EnableCrossConfigBuild() && !dep_target.IsCross())) {
continue;
}
@ -1863,6 +1865,7 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
byproducts.push_back(
this->BuildAlias(GetByproductsForCleanTargetName(), config));
}
byproducts.emplace_back(GetByproductsForCleanTargetName());
build.Variables["TARGETS"] = cmJoin(byproducts, " ");
for (auto const& fileConfig : configs) {

@ -2682,17 +2682,29 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_FLAGS_", configUpper));
bool editAndContinueDebugInfo =
langFlags.find("/ZI") != std::string::npos ||
langFlags.find("-ZI") != std::string::npos;
bool enableDebuggingInformation =
langFlags.find("/Zi") != std::string::npos ||
langFlags.find("-Zi") != std::string::npos;
// MSVC 2008 is producing both .pdb and .idb files with /Zi.
if ((langFlags.find("/ZI") != std::string::npos ||
langFlags.find("-ZI") != std::string::npos) ||
(cmSystemTools::VersionCompare(cmSystemTools::OP_LESS,
compilerVersion.c_str(),
"16.0") &&
compilerId == "MSVC")) {
bool msvc2008OrLess =
cmSystemTools::VersionCompare(
cmSystemTools::OP_LESS, compilerVersion.c_str(), "16.0") &&
compilerId == "MSVC";
// but not when used via toolset -Tv90
if (this->Makefile->GetSafeDefinition(
"CMAKE_VS_PLATFORM_TOOLSET") == "v90") {
msvc2008OrLess = false;
}
if (editAndContinueDebugInfo || msvc2008OrLess) {
CopyPchCompilePdb(config, target, *ReuseFrom, reuseTarget,
{ ".pdb", ".idb" });
} else if ((langFlags.find("/Zi") != std::string::npos ||
langFlags.find("-Zi") != std::string::npos)) {
} else if (enableDebuggingInformation) {
CopyPchCompilePdb(config, target, *ReuseFrom, reuseTarget,
{ ".pdb" });
}

@ -100,6 +100,8 @@ void cmNinjaUtilityTargetGenerator::Generate(const std::string& config)
if (genTarget->Target->GetType() != cmStateEnums::GLOBAL_TARGET) {
lg->AppendTargetOutputs(genTarget, gg->GetByproductsForCleanTarget(),
config);
std::copy(util_outputs.begin(), util_outputs.end(),
std::back_inserter(gg->GetByproductsForCleanTarget()));
}
lg->AppendTargetDepends(genTarget, deps, config, config);

@ -1224,9 +1224,13 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
if (this->Moc.ExecutableTarget != nullptr) {
dependencies.push_back(this->Moc.ExecutableTarget->Target->GetName());
} else if (!this->Moc.Executable.empty()) {
dependencies.push_back(this->Moc.Executable);
}
if (this->Uic.ExecutableTarget != nullptr) {
dependencies.push_back(this->Uic.ExecutableTarget->Target->GetName());
} else if (!this->Uic.Executable.empty()) {
dependencies.push_back(this->Uic.Executable);
}
// Create the custom command that outputs the timestamp file.
@ -1514,6 +1518,7 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
info.SetConfig("PARSE_CACHE_FILE", this->AutogenTarget.ParseCacheFile);
info.Set("DEP_FILE", this->AutogenTarget.DepFile);
info.Set("DEP_FILE_RULE_NAME", this->AutogenTarget.DepFileRuleName);
info.SetArray("CMAKE_LIST_FILES", this->Makefile->GetListFiles());
info.SetArray("HEADER_EXTENSIONS",
this->Makefile->GetCMakeInstance()->GetHeaderExtensions());
info.SetArrayArray(

@ -184,6 +184,7 @@ public:
std::string DepFile;
std::string DepFileRuleName;
std::vector<std::string> HeaderExtensions;
std::vector<std::string> ListFiles;
};
/** Shared common variables. */
@ -191,7 +192,7 @@ public:
{
public:
// -- Parse Cache
bool ParseCacheChanged = false;
std::atomic<bool> ParseCacheChanged = ATOMIC_VAR_INIT(false);
cmFileTime ParseCacheTime;
ParseCacheT ParseCache;
@ -1776,16 +1777,24 @@ bool cmQtAutoMocUicT::JobProbeDepsMocT::Probe(MappingT const& mapping,
{
// Check dependency timestamps
std::string const sourceDir = SubDirPrefix(sourceFile);
for (std::string const& dep : mapping.SourceFile->ParseData->Moc.Depends) {
auto& dependencies = mapping.SourceFile->ParseData->Moc.Depends;
for (auto it = dependencies.begin(); it != dependencies.end(); ++it) {
auto& dep = *it;
// Find dependency file
auto const depMatch = FindDependency(sourceDir, dep);
if (depMatch.first.empty()) {
Log().Warning(GenT::MOC,
cmStrCat(MessagePath(sourceFile), " depends on ",
MessagePath(dep),
" but the file does not exist."));
continue;
if (reason != nullptr) {
*reason =
cmStrCat("Generating ", MessagePath(outputFile), " from ",
MessagePath(sourceFile), ", because its dependency ",
MessagePath(dep), " vanished.");
}
dependencies.erase(it);
BaseEval().ParseCacheChanged = true;
return true;
}
// Test if dependency file is older
if (outputFileTime.Older(depMatch.second)) {
if (reason != nullptr) {
@ -2176,7 +2185,7 @@ void cmQtAutoMocUicT::JobDepFilesMergeT::Process()
return dependenciesFromDepFile(f.c_str());
};
std::vector<std::string> dependencies;
std::vector<std::string> dependencies = BaseConst().ListFiles;
ParseCacheT& parseCache = BaseEval().ParseCache;
auto processMappingEntry = [&](const MappingMapT::value_type& m) {
auto cacheEntry = parseCache.GetOrInsert(m.first);
@ -2257,6 +2266,7 @@ bool cmQtAutoMocUicT::InitFromInfo(InfoT const& info)
!info.GetString("DEP_FILE_RULE_NAME", BaseConst_.DepFileRuleName,
false) ||
!info.GetStringConfig("SETTINGS_FILE", SettingsFile_, true) ||
!info.GetArray("CMAKE_LIST_FILES", BaseConst_.ListFiles, true) ||
!info.GetArray("HEADER_EXTENSIONS", BaseConst_.HeaderExtensions, true) ||
!info.GetString("QT_MOC_EXECUTABLE", MocConst_.Executable, false) ||
!info.GetString("QT_UIC_EXECUTABLE", UicConst_.Executable, false)) {

@ -4927,6 +4927,7 @@ std::string cmVisualStudio10TargetGenerator::GetCSharpSourceLink(
// for this file exists, otherwise we check if the path relative to current
// source- or binary-dir is used within the link and return that
std::string link;
std::string sourceGroupedFile;
std::string const& fullFileName = source->GetFullPath();
std::string const& srcDir = this->Makefile->GetCurrentSourceDirectory();
std::string const& binDir = this->Makefile->GetCurrentBinaryDirectory();
@ -4936,8 +4937,14 @@ std::string cmVisualStudio10TargetGenerator::GetCSharpSourceLink(
cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(fullFileName, sourceGroups);
if (sourceGroup && !sourceGroup->GetFullName().empty()) {
link = sourceGroup->GetFullName() + "/" +
sourceGroupedFile = sourceGroup->GetFullName() + "/" +
cmsys::SystemTools::GetFilenameName(fullFileName);
cmsys::SystemTools::ConvertToUnixSlashes(sourceGroupedFile);
}
if (!sourceGroupedFile.empty() &&
cmHasSuffix(fullFileName, sourceGroupedFile)) {
link = sourceGroupedFile;
} else if (cmHasPrefix(fullFileName, srcDir)) {
link = fullFileName.substr(srcDir.length() + 1);
} else if (cmHasPrefix(fullFileName, binDir)) {

@ -454,6 +454,20 @@
"value": "stdcpplatest",
"flags": []
},
{
"name": "LanguageStandard_C",
"switch": "std:c11",
"comment": "ISO C11 Standard",
"value": "stdc11",
"flags": []
},
{
"name": "LanguageStandard_C",
"switch": "std:c17",
"comment": "ISO C17 (2018) Standard",
"value": "stdc17",
"flags": []
},
{
"name": "PrecompiledHeader",
"switch": "Yc",

@ -2,3 +2,4 @@ ADD_TEST_MACRO(ObjCXX.ObjC++ ObjC++)
ADD_TEST_MACRO(ObjCXX.simple-build-test simple-build-test)
ADD_TEST_MACRO(ObjCXX.cxx-file-extension-test cxx-file-extension-test)
ADD_TEST_MACRO(ObjCXX.objcxx-file-extension-test objcxx-file-extension-test)
ADD_TEST_MACRO(ObjCXX.cxx-as-objcxx cxx-as-objcxx)

@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.18)
project(cxx-as-objcxx LANGUAGES OBJCXX)
add_executable(cxx-as-objcxx main.cpp)
set_source_files_properties(main.cpp PROPERTIES LANGUAGE OBJCXX)

@ -0,0 +1,6 @@
#import <Foundation/Foundation.h>
int main(int argc, char* argv[])
{
return 0;
}

@ -0,0 +1,96 @@
# This test checks whether adding a source file to the project triggers an AUTOMOC re-run.
cmake_minimum_required(VERSION 3.10)
project(RerunMocOnAddFile)
include("../AutogenCoreTest.cmake")
# Create an executable to generate a clean target
set(main_source "${CMAKE_CURRENT_BINARY_DIR}/generated_main.cpp")
file(WRITE "${main_source}" "int main() {}")
add_executable(exe "${main_source}")
# Utility variables
set(timeformat "%Y.%j.%H.%M%S")
set(testProjectTemplateDir "${CMAKE_CURRENT_SOURCE_DIR}/MocOnAddFile")
set(testProjectSrc "${CMAKE_CURRENT_BINARY_DIR}/MocOnAddFile")
set(testProjectBinDir "${CMAKE_CURRENT_BINARY_DIR}/MocOnAddFile-build")
# Utility macros
macro(sleep)
message(STATUS "Sleeping for a few seconds.")
execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
endmacro()
macro(acquire_timestamp When)
file(TIMESTAMP "${mocBasicBin}" time${When} "${timeformat}")
endmacro()
macro(rebuild buildName)
message(STATUS "Starting build ${buildName}.")
execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${testProjectBinDir}" RESULT_VARIABLE result)
if (result)
message(FATAL_ERROR "Build ${buildName} failed.")
else()
message(STATUS "Build ${buildName} finished.")
endif()
endmacro()
macro(require_change)
if (timeAfter VERSION_GREATER timeBefore)
message(STATUS "As expected the file ${mocBasicBin} changed.")
else()
message(SEND_ERROR "Unexpectedly the file ${mocBasicBin} did not change!\nTimestamp pre: ${timeBefore}\nTimestamp aft: ${timeAfter}\n")
endif()
endmacro()
macro(require_change_not)
if (timeAfter VERSION_GREATER timeBefore)
message(SEND_ERROR "Unexpectedly the file ${mocBasicBin} changed!\nTimestamp pre: ${timeBefore}\nTimestamp aft: ${timeAfter}\n")
else()
message(STATUS "As expected the file ${mocBasicBin} did not change.")
endif()
endmacro()
# Create the test project from the template
unset(additional_project_sources)
unset(main_cpp_includes)
configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt")
configure_file("${testProjectTemplateDir}/main.cpp.in" "${testProjectSrc}/main.cpp")
# Initial build
try_compile(MOC_RERUN
"${testProjectBinDir}"
"${testProjectSrc}"
MocOnAddFile
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
"-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
if (NOT MOC_RERUN)
message(FATAL_ERROR "Initial build of mocOnAddFile failed. Output: ${output}")
endif()
# Sleep to ensure new timestamps
sleep()
# Add a QObject class (defined in header) to the project and build
set(additional_project_sources myobject.cpp)
set(main_cpp_includes "#include \"myobject.h\"")
configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt"
@ONLY)
configure_file("${testProjectTemplateDir}/main.cpp.in" "${testProjectSrc}/main.cpp" @ONLY)
configure_file("${testProjectTemplateDir}/myobject.h" "${testProjectSrc}/myobject.h" COPYONLY)
configure_file("${testProjectTemplateDir}/myobject.cpp" "${testProjectSrc}/myobject.cpp" COPYONLY)
rebuild(2)
# Sleep to ensure new timestamps
sleep()
# Add a QObject class (defined in source) to the project and build
set(additional_project_sources myobject.cpp anotherobject.cpp)
configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt"
@ONLY)
configure_file("${testProjectTemplateDir}/anotherobject.cpp" "${testProjectSrc}/anotherobject.cpp"
COPYONLY)
rebuild(3)

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.10)
project(MocOnAddFile)
include("@CMAKE_CURRENT_LIST_DIR@/../AutogenCoreTest.cmake")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
add_executable(mocOnAddFile main.cpp @additional_project_sources@)
target_link_libraries(mocOnAddFile ${QT_QTCORE_TARGET})

@ -0,0 +1,15 @@
#include <qobject.h>
class AnotherObject : public QObject
{
Q_OBJECT
public:
AnotherObject() {}
};
AnotherObject* createAnotherObject()
{
return new AnotherObject();
}
#include "anotherobject.moc"

@ -0,0 +1,6 @@
@main_cpp_includes@
int main(int argc, char *argv[])
{
return 0;
}

@ -0,0 +1,6 @@
#include "myobject.h"
MyObject::MyObject(QObject* parent)
: QObject(parent)
{
}

@ -0,0 +1,13 @@
#ifndef MYOBJECT_H
#define MYOBJECT_H
#include <qobject.h>
class MyObject : public QObject
{
Q_OBJECT
public:
MyObject(QObject* parent = 0);
};
#endif

@ -0,0 +1,80 @@
# This test checks whether a missing dependency of the moc output triggers an AUTOMOC re-run.
cmake_minimum_required(VERSION 3.10)
project(RerunMocOnMissingDependency)
include("../AutogenCoreTest.cmake")
# Create an executable to generate a clean target
set(main_source "${CMAKE_CURRENT_BINARY_DIR}/generated_main.cpp")
file(WRITE "${main_source}" "int main() {}")
add_executable(exe "${main_source}")
# Utility variables
set(testProjectTemplateDir "${CMAKE_CURRENT_SOURCE_DIR}/MocOnMissingDependency")
set(testProjectSrc "${CMAKE_CURRENT_BINARY_DIR}/MocOnMissingDependency")
set(testProjectBinDir "${CMAKE_CURRENT_BINARY_DIR}/MocOnMissingDependency-build")
if(DEFINED Qt5Core_VERSION AND Qt5Core_VERSION VERSION_GREATER_EQUAL "5.15.0")
set(moc_depfiles_supported TRUE)
else()
set(moc_depfiles_supported FALSE)
endif()
# Utility macros
macro(sleep)
message(STATUS "Sleeping for a few seconds.")
execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
endmacro()
macro(rebuild buildName)
message(STATUS "Starting build ${buildName}.")
execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${testProjectBinDir}"
RESULT_VARIABLE result OUTPUT_VARIABLE output)
if (result)
message(FATAL_ERROR "Build ${buildName} failed.")
else()
message(STATUS "Build ${buildName} finished.")
endif()
endmacro()
# Create the test project from the template
file(COPY "${testProjectTemplateDir}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt" @ONLY)
# Initial build
file(REMOVE_RECURSE "${testProjectBinDir}")
try_compile(MOC_RERUN
"${testProjectBinDir}"
"${testProjectSrc}"
MocOnMissingDependency
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
"-DCMAKE_AUTOGEN_VERBOSE=ON"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
if (NOT MOC_RERUN)
message(FATAL_ERROR "Initial build of mocOnMissingDependency failed. Output: ${output}")
endif()
# Sleep to ensure new timestamps
sleep()
if(moc_depfiles_supported)
# Remove the dependency inc1/foo.h and build again.
# We expect that the moc_XXX.cpp file gets re-generated. But only if we have depfile support.
file(REMOVE_RECURSE "${testProjectSrc}/inc1")
rebuild(2)
if(NOT output MATCHES "AutoMoc: Generating \"[^\"]*moc_myobject.cpp\"")
message(FATAL_ERROR "moc_myobject.cpp was not re-generated "
"after removing one of its dependencies")
endif()
endif()
# Sleep to ensure new timestamps
sleep()
# The next build should *not* re-renerate any moc outputs
rebuild(3)
if(output MATCHES "AutoMoc: Generating")
message(FATAL_ERROR "moc_myobject.cpp was not re-generated "
"after removing one of its dependencies")
endif()

@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.18)
project(MocOnMissingDependency)
include("@CMAKE_CURRENT_LIST_DIR@/../AutogenCoreTest.cmake")
set(CMAKE_AUTOMOC ON)
add_executable(MocOnMissingDependency main.cpp myobject.cpp)
target_include_directories(MocOnMissingDependency PRIVATE inc1 inc2)
target_link_libraries(MocOnMissingDependency PRIVATE ${QT_QTCORE_TARGET})

@ -0,0 +1,9 @@
#include <iostream>
#include "myobject.h"
int main(int argc, char* argv[])
{
MyObject obj;
return 0;
}

@ -0,0 +1,6 @@
#include "myobject.h"
MyObject::MyObject(QObject* parent)
: QObject(parent)
{
}

@ -0,0 +1,10 @@
#pragma once
#include <foo.h>
class MyObject : public QObject
{
Q_OBJECT
public:
MyObject(QObject* parent = 0);
};

@ -20,6 +20,8 @@ ADD_AUTOGEN_TEST(RccOffMocLibrary)
ADD_AUTOGEN_TEST(RccOnly rccOnly)
ADD_AUTOGEN_TEST(RccSkipSource)
ADD_AUTOGEN_TEST(RerunMocBasic)
ADD_AUTOGEN_TEST(RerunMocOnAddFile)
ADD_AUTOGEN_TEST(RerunMocOnMissingDependency)
ADD_AUTOGEN_TEST(RerunRccConfigChange)
ADD_AUTOGEN_TEST(RerunRccDepends)
ADD_AUTOGEN_TEST(SameName sameName)

@ -143,14 +143,14 @@ if(CMAKE_GENERATOR MATCHES "Ninja")
list(APPEND Ninja_ARGS -DTEST_Fortran=1)
endif()
if(CMake_TEST_Qt5 AND Qt5Core_FOUND)
list(APPEND Ninja_ARGS -DCMake_TEST_Qt5=1 -DCMAKE_TEST_Qt5Core_Version=${Qt5Core_VERSION})
list(APPEND Ninja_ARGS -DCMake_TEST_Qt5=1 -DQt5Core_DIR=${Qt5Core_DIR} -DCMAKE_TEST_Qt5Core_Version=${Qt5Core_VERSION})
endif()
add_RunCMake_test(Ninja)
set(NinjaMultiConfig_ARGS
-DCYGWIN=${CYGWIN}
)
if(CMake_TEST_Qt5 AND Qt5Core_FOUND)
list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_Qt5=1)
list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_Qt5=1 -DQt5Core_DIR=${Qt5Core_DIR} -DCMAKE_TEST_Qt5Core_Version=${Qt5Core_VERSION})
endif()
if(DEFINED CMake_TEST_CUDA)
list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA})

@ -327,6 +327,7 @@ run_ChangeBuildType()
function(run_Qt5AutoMocDeps)
if(CMake_TEST_Qt5 AND CMAKE_TEST_Qt5Core_Version VERSION_GREATER_EQUAL 5.15.0)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Qt5AutoMocDeps-build)
set(RunCMake_TEST_OPTIONS "-DQt5Core_DIR=${Qt5Core_DIR}")
run_cmake(Qt5AutoMocDeps)
unset(RunCMake_TEST_OPTIONS)
# Build the project.

@ -0,0 +1,5 @@
check_files("${RunCMake_TEST_BINARY_DIR}"
INCLUDE
${TARGET_BYPRODUCTS_LeafExe}
${TARGET_BYPRODUCTS_RootCustom}
)

@ -0,0 +1,6 @@
check_files("${RunCMake_TEST_BINARY_DIR}"
INCLUDE
${TARGET_BYPRODUCTS_LeafCustom}
${TARGET_BYPRODUCTS_RootCustom}
${TARGET_FILE_RootExe_Release}
)

@ -0,0 +1,7 @@
check_files("${RunCMake_TEST_BINARY_DIR}"
INCLUDE
${TARGET_FILE_LeafExe_Release}
${TARGET_BYPRODUCTS_LeafExe}
${TARGET_BYPRODUCTS_RootCustom}
${TARGET_FILE_RootExe_Release}
)

@ -34,6 +34,18 @@ add_subdirectory(CustomCommandsAndTargetsSubdir)
create_targets(Top)
add_executable(RootExe main.c)
add_custom_target(RootCustom COMMAND ${CMAKE_COMMAND} -E touch RootCustom.txt BYPRODUCTS RootCustom.txt)
add_custom_command(OUTPUT main.c COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/main.c ${CMAKE_CURRENT_BINARY_DIR}/main.c DEPENDS RootCustom)
add_executable(LeafExe ${CMAKE_CURRENT_BINARY_DIR}/main.c)
add_custom_target(LeafCustom COMMAND ${CMAKE_COMMAND} -E touch LeafCustom.txt BYPRODUCTS LeafCustom.txt DEPENDS RootCustom RootExe)
add_dependencies(LeafExe RootExe)
file(APPEND "${CMAKE_BINARY_DIR}/target_files_custom.cmake"
"set(TARGET_BYPRODUCTS_LeafCustom [==[${CMAKE_CURRENT_BINARY_DIR}/LeafCustom.txt]==])
set(TARGET_BYPRODUCTS_LeafExe [==[${CMAKE_CURRENT_BINARY_DIR}/main.c]==])
set(TARGET_BYPRODUCTS_RootCustom [==[${CMAKE_CURRENT_BINARY_DIR}/RootCustom.txt]==])
")
include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake)
generate_output_files(TopPostBuild SubdirPostBuild)
generate_output_files(TopPostBuild SubdirPostBuild RootExe LeafExe)
file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "include(\${CMAKE_CURRENT_LIST_DIR}/target_files_custom.cmake)\n")

@ -0,0 +1,7 @@
input: CUSTOM_COMMAND(
[^
]*)*
\|\| exe_autogen_timestamp_deps:Debug(
[^
]*)*
outputs:

@ -235,6 +235,12 @@ run_cmake_build(CustomCommandsAndTargets debug-in-release-graph-postbuild Releas
run_ninja(CustomCommandsAndTargets release-postbuild build-Release.ninja SubdirPostBuild)
run_cmake_build(CustomCommandsAndTargets debug-targetpostbuild Debug TopTargetPostBuild)
run_ninja(CustomCommandsAndTargets release-targetpostbuild build-Release.ninja SubdirTargetPostBuild)
run_cmake_build(CustomCommandsAndTargets release-clean Release clean:all)
run_ninja(CustomCommandsAndTargets release-leaf-custom build-Release.ninja LeafCustom.txt)
run_cmake_build(CustomCommandsAndTargets release-clean Release clean:all)
run_ninja(CustomCommandsAndTargets release-leaf-exe build-Release.ninja LeafExe)
run_cmake_build(CustomCommandsAndTargets release-clean Release clean:all)
run_ninja(CustomCommandsAndTargets release-leaf-byproduct build-Release.ninja main.c)
unset(RunCMake_TEST_BINARY_DIR)
@ -300,9 +306,12 @@ endif()
if(CMake_TEST_Qt5)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Qt5-build)
set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all")
set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all" "-DQt5Core_DIR=${Qt5Core_DIR}")
run_cmake_configure(Qt5)
unset(RunCMake_TEST_OPTIONS)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
run_cmake_build(Qt5 debug-in-release-graph Release exe:Debug)
if(CMAKE_TEST_Qt5Core_Version VERSION_GREATER_EQUAL 5.15.0)
run_ninja(Qt5 automoc-check build-Debug.ninja -t query exe_autogen/timestamp)
endif()
endif()

@ -9,12 +9,13 @@ file(STRINGS "${csProjFile}" lines)
include(${RunCMake_TEST_SOURCE_DIR}/VsCsharpSourceGroupHelpers.cmake)
set(SOURCE_GROUPS_TO_FIND
"CSharpSourceGroup"
"CSharpSourceGroup/nested"
"Images"
"CSharpSourceGroup\\\\foo\\.cs"
"CSharpSourceGroup\\\\nested\\\\baz\\.cs"
"CSharpSourceGroup\\\\images\\\\empty\\.bmp"
"VsCsharpSourceGroup\\.png"
)
foreach(GROUP_NAME IN LISTS ${SOURCE_GROUPS_TO_FIND})
foreach(GROUP_NAME IN LISTS SOURCE_GROUPS_TO_FIND)
find_source_group("${lines}" ${GROUP_NAME})
if(NOT ${SOURCE_GROUP_FOUND})
return()

@ -9,8 +9,14 @@ set(SRC_FILES
set(IMAGE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/CSharpSourceGroup/Images/empty.bmp
)
# We explicitly don't set a source group for a source in the root level
# because of https://gitlab.kitware.com/cmake/cmake/-/issues/21221
set(RESOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/VsCsharpSourceGroup.png
)
add_library(VsCsharpSourceGroup SHARED ${SRC_FILES} ${IMAGE_FILES})
add_library(VsCsharpSourceGroup SHARED ${SRC_FILES} ${IMAGE_FILES} ${RESOURCE_FILES})
source_group("CSharpSourceGroup" FILES ${CMAKE_CURRENT_SOURCE_DIR}/CSharpSourceGroup/foo.cs)
source_group("CSharpSourceGroup/nested" FILES ${CMAKE_CURRENT_SOURCE_DIR}/CSharpSourceGroup/nested/baz.cs)
source_group("Images" FILES ${IMAGE_FILES})

@ -19,3 +19,4 @@ run_cmake(foreach-RANGE-non-int-test-3-1)
run_cmake(foreach-RANGE-non-int-test-3-2)
run_cmake(foreach-RANGE-non-int-test-3-3)
run_cmake(foreach-RANGE-invalid-test)
run_cmake(foreach-RANGE-out-of-range-test)

@ -0,0 +1,4 @@
^CMake Error at foreach-RANGE-out-of-range-test\.cmake:[0-9]+ \(foreach\):
foreach Integer out of range: '10000000000000000000'
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)$

@ -0,0 +1,3 @@
foreach(a RANGE 10000000000000000000)
break()
endforeach()

@ -91,6 +91,15 @@ add_test(NAME UseSWIG.MultiplePython COMMAND
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
add_test(NAME UseSWIG.MultipleFiles COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/UseSWIG/MultipleFiles"
"${CMake_BINARY_DIR}/Tests/UseSWIG/MultipleFiles"
${build_generator_args}
--build-project TestMultipleFiles
--build-options ${build_options}
)
add_test(NAME UseSWIG.ModuleVersion2 COMMAND

@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.18)
project(TestMultipleFiles CXX)
find_package(SWIG REQUIRED)
include(UseSWIG)
unset(SWIG_LANG_TYPE)
unset(SWIG_LANG_INCLUDE_DIRECTORIES)
unset(SWIG_LANG_DEFINITIONS)
unset(SWIG_LANG_OPTIONS)
unset(SWIG_LANG_LIBRARIES)
find_package(Python3 REQUIRED COMPONENTS Development)
set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/add.i" PROPERTY CPLUSPLUS ON)
set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/sub.i" PROPERTY CPLUSPLUS ON)
set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/add.i" PROPERTY SWIG_MODULE_NAME _add)
set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/sub.i" PROPERTY SWIG_MODULE_NAME _sub)
swig_add_library(example
LANGUAGE python
TYPE MODULE
SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/add.i"
"${CMAKE_CURRENT_SOURCE_DIR}/sub.i"
"${CMAKE_CURRENT_SOURCE_DIR}/add.cxx"
"${CMAKE_CURRENT_SOURCE_DIR}/sub.cxx")
target_include_directories(example PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(example PRIVATE Python3::Module)

@ -0,0 +1,6 @@
#include "add.h"
int add(int a, int b)
{
return a + b;
}

@ -0,0 +1 @@
int add(int a, int b);

@ -0,0 +1,4 @@
%{
#include "add.h"
%}
%include "add.h"

@ -0,0 +1,6 @@
#include "sub.h"
int sub(int a, int b)
{
return a - b;
}

@ -0,0 +1 @@
int sub(int a, int b);

@ -0,0 +1,5 @@
%{
#include "sub.h"
%}
%include "sub.h"
Loading…
Cancel
Save