summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Help/command/find_file.rst3
-rw-r--r--Help/command/find_library.rst3
-rw-r--r--Help/command/find_path.rst3
-rw-r--r--Help/release/3.19.rst17
-rw-r--r--Modules/CMakeIOSInstallCombined.cmake31
-rw-r--r--Modules/Compiler/Clang.cmake1
-rw-r--r--Modules/FindBoost.cmake19
-rw-r--r--Modules/FindCUDAToolkit.cmake2
-rw-r--r--Modules/FindXCTest.cmake11
-rw-r--r--Modules/Platform/Windows-Clang.cmake1
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx2
-rw-r--r--Source/cmComputeLinkInformation.cxx30
-rw-r--r--Source/cmComputeLinkInformation.h4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx15
-rw-r--r--Source/cmLocalGenerator.cxx2
-rw-r--r--Source/cmLocalGenerator.h2
-rw-r--r--Source/cmLocalXCodeGenerator.cxx60
-rw-r--r--Source/cmLocalXCodeGenerator.h2
-rw-r--r--Source/cmStandardLexer.h2
-rw-r--r--Tests/Framework/CMakeLists.txt16
-rw-r--r--Tests/Framework/External/CMakeLists.txt5
-rw-r--r--Tests/Framework/External/external.c4
-rw-r--r--Tests/Framework/useExternal.c6
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake29
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-cmakeinstall-check.cmake2
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake2
27 files changed, 226 insertions, 52 deletions
diff --git a/Help/command/find_file.rst b/Help/command/find_file.rst
index 3f03f37e3..39dfb8582 100644
--- a/Help/command/find_file.rst
+++ b/Help/command/find_file.rst
@@ -17,7 +17,8 @@ find_file
.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH`
.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH`
-.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``PATH`` and ``INCLUDE``.
+.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``INCLUDE``
+ and ``PATH``.
.. |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| replace:: On Windows hosts:
``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|.
diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst
index 8a55aca3d..ab957ce9b 100644
--- a/Help/command/find_library.rst
+++ b/Help/command/find_library.rst
@@ -17,7 +17,8 @@ find_library
.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_LIBRARY_PATH`
.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH`
-.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``PATH`` and ``INCLUDE``.
+.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``LIB``
+ and ``PATH``.
.. |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| replace:: On Windows hosts:
``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|.
diff --git a/Help/command/find_path.rst b/Help/command/find_path.rst
index 52ffe3c79..ec6677107 100644
--- a/Help/command/find_path.rst
+++ b/Help/command/find_path.rst
@@ -17,7 +17,8 @@ find_path
.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH`
.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH`
-.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``PATH`` and ``INCLUDE``.
+.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``INCLUDE``
+ and ``PATH``.
.. |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| replace:: On Windows hosts:
``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|.
diff --git a/Help/release/3.19.rst b/Help/release/3.19.rst
index d819e8ce1..d8f4f9d79 100644
--- a/Help/release/3.19.rst
+++ b/Help/release/3.19.rst
@@ -408,3 +408,20 @@ Changes made since CMake 3.19.0 include the following.
variable introduced in 3.19.0 previously worked only with the
:generator:`Visual Studio 14 2015` generator. It has now been fixed to
work with :ref:`Visual Studio Generators` for later VS versions too.
+
+
+3.19.5
+------
+
+* When :prop_tgt:`IOS_INSTALL_COMBINED` is enabled and the :generator:`Xcode`
+ generator is used, it is now possible to initiate an install or package
+ creation by running ``cmake --install`` or ``cpack`` from the command line.
+ When using the Xcode new build system, these are the only supported methods
+ due to a limitation of Xcode. Initiating these operations by building the
+ ``install`` or ``package`` targets in Xcode is only supported when using
+ the legacy build system.
+
+* The framework handling introduced in 3.19.0 as part of supporting Xcode's
+ *Link Binaries With Libraries* build phase broke the ability to switch
+ between device and simulator builds without reconfiguring. That capability
+ has now been restored.
diff --git a/Modules/CMakeIOSInstallCombined.cmake b/Modules/CMakeIOSInstallCombined.cmake
index 44bb622f4..b02221759 100644
--- a/Modules/CMakeIOSInstallCombined.cmake
+++ b/Modules/CMakeIOSInstallCombined.cmake
@@ -3,10 +3,11 @@
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
+cmake_policy(SET CMP0054 NEW)
# Function to print messages of this module
function(_ios_install_combined_message)
- message("[iOS combined] " ${ARGN})
+ message(STATUS "[iOS combined] " ${ARGN})
endfunction()
# Get build settings for the current target/config/SDK by running
@@ -176,29 +177,33 @@ function(_ios_install_combined_keep_archs lib archs)
endforeach()
endfunction()
-function(_ios_install_combined_detect_sdks this_sdk_var corr_sdk_var)
- set(this_sdk "$ENV{PLATFORM_NAME}")
- if("${this_sdk}" STREQUAL "")
- message(FATAL_ERROR "Environment variable PLATFORM_NAME is empty")
+function(_ios_install_combined_detect_associated_sdk corr_sdk_var)
+ if("${PLATFORM_NAME}" STREQUAL "")
+ message(FATAL_ERROR "PLATFORM_NAME should not be empty")
endif()
set(all_platforms "$ENV{SUPPORTED_PLATFORMS}")
- if("${all_platforms}" STREQUAL "")
- message(FATAL_ERROR "Environment variable SUPPORTED_PLATFORMS is empty")
+ if("${SUPPORTED_PLATFORMS}" STREQUAL "")
+ _ios_install_combined_get_build_setting(
+ ${PLATFORM_NAME} SUPPORTED_PLATFORMS all_platforms)
+ if("${all_platforms}" STREQUAL "")
+ message(FATAL_ERROR
+ "SUPPORTED_PLATFORMS not set as an environment variable nor "
+ "able to be determined from project")
+ endif()
endif()
separate_arguments(all_platforms)
- if(NOT this_sdk IN_LIST all_platforms)
- message(FATAL_ERROR "`${this_sdk}` not found in `${all_platforms}`")
+ if(NOT PLATFORM_NAME IN_LIST all_platforms)
+ message(FATAL_ERROR "`${PLATFORM_NAME}` not found in `${all_platforms}`")
endif()
- list(REMOVE_ITEM all_platforms "" "${this_sdk}")
+ list(REMOVE_ITEM all_platforms "" "${PLATFORM_NAME}")
list(LENGTH all_platforms all_platforms_length)
if(NOT all_platforms_length EQUAL 1)
message(FATAL_ERROR "Expected one element: ${all_platforms}")
endif()
- set(${this_sdk_var} "${this_sdk}" PARENT_SCOPE)
set(${corr_sdk_var} "${all_platforms}" PARENT_SCOPE)
endfunction()
@@ -274,10 +279,10 @@ function(ios_install_combined target destination)
_ios_install_combined_message("Destination: ${destination}")
# Get SDKs
- _ios_install_combined_detect_sdks(this_sdk corr_sdk)
+ _ios_install_combined_detect_associated_sdk(corr_sdk)
# Get architectures of the target
- _ios_install_combined_get_valid_archs("${this_sdk}" this_valid_archs)
+ _ios_install_combined_get_valid_archs("${PLATFORM_NAME}" this_valid_archs)
_ios_install_combined_get_valid_archs("${corr_sdk}" corr_valid_archs)
_ios_install_combined_prune_common_archs("${corr_sdk}" corr_valid_archs this_valid_archs)
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index 27692c2fe..c43265d58 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -19,7 +19,6 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC")
macro(__compiler_clang lang)
- set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-imsvc ")
endmacro()
else()
include(Compiler/GNU)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 00e4ff1d2..54d9593ca 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -1186,11 +1186,26 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
set(_Boost_TIMER_DEPENDENCIES chrono)
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(Boost_VERSION_STRING VERSION_LESS 1.75.0)
+ set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time)
+ set(_Boost_COROUTINE_DEPENDENCIES context)
+ set(_Boost_FIBER_DEPENDENCIES context)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
+ set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
+ set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic)
+ set(_Boost_TIMER_DEPENDENCIES chrono)
+ set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
else()
set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time)
set(_Boost_COROUTINE_DEPENDENCIES context)
set(_Boost_FIBER_DEPENDENCIES context)
set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_JSON_DEPENDENCIES container)
set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic)
set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
set(_Boost_MPI_DEPENDENCIES serialization)
@@ -1200,7 +1215,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
set(_Boost_TIMER_DEPENDENCIES chrono)
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
- if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.75.0)
+ if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.76.0)
message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets")
endif()
endif()
@@ -1472,7 +1487,7 @@ else()
# _Boost_COMPONENT_HEADERS. See the instructions at the top of
# _Boost_COMPONENT_DEPENDENCIES.
set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
- "1.74.0" "1.74"
+ "1.75.0" "1.75" "1.74.0" "1.74"
"1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69"
"1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65"
"1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60"
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index b3c8569bf..d4cd338d3 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -561,7 +561,7 @@ else()
_CUDAToolkit_find_root_dir(SEARCH_PATHS "${CUDAToolkit_ROOT}" FIND_FLAGS PATH_SUFFIXES bin NO_DEFAULT_PATH)
endif()
if(NOT CUDAToolkit_ROOT_DIR)
- _CUDAToolkit_find_root_dir(FIND_FLAGS PATHS "ENV CUDA_PATH" PATH_SUFFIXES bin)
+ _CUDAToolkit_find_root_dir(FIND_FLAGS PATHS ENV CUDA_PATH PATH_SUFFIXES bin)
endif()
# If the user specified CUDAToolkit_ROOT but the toolkit could not be found, this is an error.
diff --git a/Modules/FindXCTest.cmake b/Modules/FindXCTest.cmake
index 1f6e82513..48371e620 100644
--- a/Modules/FindXCTest.cmake
+++ b/Modules/FindXCTest.cmake
@@ -155,9 +155,16 @@ function(xctest_add_bundle target testee)
set_target_properties(${target} PROPERTIES
XCODE_ATTRIBUTE_BUNDLE_LOADER "$(TEST_HOST)"
XCODE_ATTRIBUTE_TEST_HOST "$<TARGET_FILE:${testee}>")
- if(NOT XCODE_VERSION VERSION_LESS 7.3)
+ if(XCODE_VERSION VERSION_GREATER_EQUAL 7.3)
+ # CMAKE_XCODE_BUILD_SYSTEM equals 12 means that at least Xcode 11.x is used.
+ if(CMAKE_XCODE_BUILD_SYSTEM EQUAL 12 AND
+ NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ set(_output_directory "$<TARGET_BUNDLE_CONTENT_DIR:${testee}>")
+ else()
+ set(_output_directory "$<TARGET_BUNDLE_CONTENT_DIR:${testee}>/PlugIns")
+ endif()
set_target_properties(${target} PROPERTIES
- LIBRARY_OUTPUT_DIRECTORY "$<TARGET_BUNDLE_CONTENT_DIR:${testee}>/PlugIns")
+ LIBRARY_OUTPUT_DIRECTORY "${_output_directory}")
endif()
else(XCODE)
target_link_libraries(${target}
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index 389d6ab02..7697407fd 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -169,6 +169,7 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
macro(__windows_compiler_clang_base lang)
set(_COMPILE_${lang} "${_COMPILE_${lang}_MSVC}")
__windows_compiler_msvc(${lang})
+ set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-imsvc ")
endmacro()
else()
cmake_policy(GET CMP0091 __WINDOWS_CLANG_CMP0091)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 2b6c3819e..2db3ea84a 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 19)
-set(CMake_VERSION_PATCH 4)
+set(CMake_VERSION_PATCH 5)
#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 [==[0c86d15459 CMake 3.19.4]==])
+ set(git_info [==[d5401de605 CMake 3.19.5]==])
# 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]* "
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index f30ba2bd2..57cc02420 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -240,7 +240,7 @@ int cmCTestUpdateHandler::ProcessHandler()
if (localModifications) {
xml.Content("Update error: "
"There are modified or conflicting files in the repository");
- cmCTestLog(this->CTest, ERROR_MESSAGE,
+ cmCTestLog(this->CTest, WARNING,
" There are modified or conflicting files in the repository"
<< std::endl);
}
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 201a9d9bf..b9f15b70e 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -474,6 +474,12 @@ std::vector<std::string> const& cmComputeLinkInformation::GetFrameworkPaths()
return this->FrameworkPaths;
}
+std::set<std::string> const&
+cmComputeLinkInformation::GetFrameworkPathsEmitted() const
+{
+ return this->FrameworkPathsEmitted;
+}
+
const std::set<const cmGeneratorTarget*>&
cmComputeLinkInformation::GetSharedLibrariesLinked() const
{
@@ -699,9 +705,13 @@ void cmComputeLinkInformation::AddItem(BT<std::string> const& item,
} else {
// This is not a CMake target. Use the name given.
if (cmSystemTools::FileIsFullPath(item.Value)) {
- if (cmSystemTools::FileIsDirectory(item.Value)) {
+ if (cmSystemTools::IsPathToFramework(item.Value) &&
+ this->Makefile->IsOn("APPLE")) {
+ // This is a framework.
+ this->AddFrameworkItem(item.Value);
+ } else if (cmSystemTools::FileIsDirectory(item.Value)) {
// This is a directory.
- this->AddDirectoryItem(item.Value);
+ this->DropDirectoryItem(item.Value);
} else {
// Use the full path given to the library file.
this->Depends.push_back(item.Value);
@@ -1306,16 +1316,6 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item)
}
}
-void cmComputeLinkInformation::AddDirectoryItem(std::string const& item)
-{
- if (this->Makefile->IsOn("APPLE") &&
- cmSystemTools::IsPathToFramework(item)) {
- this->AddFrameworkItem(item);
- } else {
- this->DropDirectoryItem(item);
- }
-}
-
void cmComputeLinkInformation::DropDirectoryItem(std::string const& item)
{
// A full path to a directory was found as a link item. Warn the
@@ -1342,8 +1342,8 @@ void cmComputeLinkInformation::ComputeFrameworkInfo()
"CMAKE_", this->LinkLanguage, "_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES");
this->Makefile->GetDefExpandList(implicitDirVar, implicitDirVec);
- this->FrameworkPathsEmmitted.insert(implicitDirVec.begin(),
- implicitDirVec.end());
+ this->FrameworkPathsEmitted.insert(implicitDirVec.begin(),
+ implicitDirVec.end());
// Regular expression to extract a framework path and name.
this->SplitFramework.compile("(.*)/(.*)\\.framework$");
@@ -1351,7 +1351,7 @@ void cmComputeLinkInformation::ComputeFrameworkInfo()
void cmComputeLinkInformation::AddFrameworkPath(std::string const& p)
{
- if (this->FrameworkPathsEmmitted.insert(p).second) {
+ if (this->FrameworkPathsEmitted.insert(p).second) {
this->FrameworkPaths.push_back(p);
}
}
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 543b6d7e1..9fec70206 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -55,6 +55,7 @@ public:
std::vector<BT<std::string>> GetDirectoriesWithBacktraces();
std::vector<std::string> const& GetDepends() const;
std::vector<std::string> const& GetFrameworkPaths() const;
+ std::set<std::string> const& GetFrameworkPathsEmitted() const;
std::string GetLinkLanguage() const { return this->LinkLanguage; }
std::vector<std::string> const& GetRuntimeSearchPath() const;
std::string const& GetRuntimeFlag() const { return this->RuntimeFlag; }
@@ -155,7 +156,6 @@ private:
void AddFullItem(BT<std::string> const& item);
bool CheckImplicitDirItem(std::string const& item);
void AddUserItem(BT<std::string> const& item, bool pathNotKnown);
- void AddDirectoryItem(std::string const& item);
void AddFrameworkItem(std::string const& item);
void DropDirectoryItem(std::string const& item);
bool CheckSharedLibNoSOName(std::string const& item);
@@ -165,7 +165,7 @@ private:
// Framework info.
void ComputeFrameworkInfo();
void AddFrameworkPath(std::string const& p);
- std::set<std::string> FrameworkPathsEmmitted;
+ std::set<std::string> FrameworkPathsEmitted;
cmsys::RegularExpression SplitFramework;
// Linker search path computation.
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index df45b3523..51a791532 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3620,6 +3620,15 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
// now add the left-over link libraries
{
+ // Keep track of framework search paths we've already added or that are
+ // part of the set of implicit search paths. We don't want to repeat
+ // them and we also need to avoid hard-coding any SDK-specific paths.
+ // This is essential for getting device-and-simulator builds to work,
+ // otherwise we end up hard-coding a path to the wrong SDK for
+ // SDK-provided frameworks that are added by their full path.
+ std::set<std::string> emitted(cli->GetFrameworkPathsEmitted());
+ const auto& fwPaths = cli->GetFrameworkPaths();
+ emitted.insert(fwPaths.begin(), fwPaths.end());
BuildObjectListOrString libPaths(this, true);
for (auto const& libItem : configItemMap[configName]) {
auto const& libName = *libItem;
@@ -3633,7 +3642,11 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
const auto fwName =
cmSystemTools::GetFilenameWithoutExtension(libPath);
const auto fwDir = cmSystemTools::GetParentDirectory(libPath);
- libPaths.Add("-F " + this->XCodeEscapePath(fwDir));
+ if (emitted.insert(fwDir).second) {
+ // This is a search path we had not added before and it isn't an
+ // implicit search path, so we need it
+ libPaths.Add("-F " + this->XCodeEscapePath(fwDir));
+ }
libPaths.Add("-framework " + fwName);
} else {
libPaths.Add(this->XCodeEscapePath(cleanPath));
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 2239192c8..b5580e7cc 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -644,6 +644,8 @@ void cmLocalGenerator::GenerateInstallRules()
/* clang-format on */
}
+ this->AddGeneratorSpecificInstallSetup(fout);
+
// Ask each install generator to write its code.
cmPolicies::PolicyStatus status = this->GetPolicyStatus(cmPolicies::CMP0082);
auto const& installers = this->Makefile->GetInstallGenerators();
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 22d3599e5..0fa875924 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -493,6 +493,8 @@ protected:
std::ostream& os, const std::string& config,
std::vector<std::string> const& configurationTypes);
+ virtual void AddGeneratorSpecificInstallSetup(std::ostream&) {}
+
std::string& CreateSafeUniqueObjectFileName(const std::string& sin,
std::string const& dir_max);
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index ac0d35ea8..3b4e3a8ec 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -4,6 +4,7 @@
#include "cmGeneratorTarget.h"
#include "cmGlobalXCodeGenerator.h"
+#include "cmMakefile.h"
#include "cmSourceFile.h"
class cmGeneratorTarget;
@@ -45,13 +46,66 @@ void cmLocalXCodeGenerator::Generate()
}
}
-void cmLocalXCodeGenerator::GenerateInstallRules()
+void cmLocalXCodeGenerator::AddGeneratorSpecificInstallSetup(std::ostream& os)
{
- cmLocalGenerator::GenerateInstallRules();
-
+ // First check if we need to warn about incompatible settings
for (const auto& target : this->GetGeneratorTargets()) {
target->HasMacOSXRpathInstallNameDir("");
}
+
+ // CMakeIOSInstallCombined.cmake needs to know the location of the top of
+ // the build directory
+ os << "set(CMAKE_BINARY_DIR \"" << this->GetBinaryDirectory() << "\")\n\n";
+
+ if (this->Makefile->PlatformIsAppleEmbedded()) {
+ std::string platformName;
+ switch (this->Makefile->GetAppleSDKType()) {
+ case cmMakefile::AppleSDK::IPhoneOS:
+ platformName = "iphoneos";
+ break;
+ case cmMakefile::AppleSDK::IPhoneSimulator:
+ platformName = "iphonesimulator";
+ break;
+ case cmMakefile::AppleSDK::AppleTVOS:
+ platformName = "appletvos";
+ break;
+ case cmMakefile::AppleSDK::AppleTVSimulator:
+ platformName = "appletvsimulator";
+ break;
+ case cmMakefile::AppleSDK::WatchOS:
+ platformName = "watchos";
+ break;
+ case cmMakefile::AppleSDK::WatchSimulator:
+ platformName = "watchsimulator";
+ break;
+ case cmMakefile::AppleSDK::MacOS:
+ break;
+ }
+ if (!platformName.empty()) {
+ // The effective platform name is just the platform name with a hyphen
+ // prepended. We can get the SUPPORTED_PLATFORMS from the project file
+ // at runtime, so we don't need to compute that here.
+ /* clang-format off */
+ os <<
+ "if(NOT PLATFORM_NAME)\n"
+ " if(NOT \"$ENV{PLATFORM_NAME}\" STREQUAL \"\")\n"
+ " set(PLATFORM_NAME \"$ENV{PLATFORM_NAME}\")\n"
+ " endif()\n"
+ " if(NOT PLATFORM_NAME)\n"
+ " set(PLATFORM_NAME " << platformName << ")\n"
+ " endif()\n"
+ "endif()\n\n"
+ "if(NOT EFFECTIVE_PLATFORM_NAME)\n"
+ " if(NOT \"$ENV{EFFECTIVE_PLATFORM_NAME}\" STREQUAL \"\")\n"
+ " set(EFFECTIVE_PLATFORM_NAME \"$ENV{EFFECTIVE_PLATFORM_NAME}\")\n"
+ " endif()\n"
+ " if(NOT EFFECTIVE_PLATFORM_NAME)\n"
+ " set(EFFECTIVE_PLATFORM_NAME -" << platformName << ")\n"
+ " endif()\n"
+ "endif()\n\n";
+ /* clang-format off */
+ }
+ }
}
void cmLocalXCodeGenerator::ComputeObjectFilenames(
diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h
index dd038b462..5f72f6d6c 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -32,7 +32,7 @@ public:
void AppendFlagEscape(std::string& flags,
const std::string& rawFlag) const override;
void Generate() override;
- virtual void GenerateInstallRules();
+ void AddGeneratorSpecificInstallSetup(std::ostream& os) override;
void ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping,
cmGeneratorTarget const* gt = nullptr) override;
diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h
index 020377989..64c1645a6 100644
--- a/Source/cmStandardLexer.h
+++ b/Source/cmStandardLexer.h
@@ -6,7 +6,7 @@
/* Needed for glibc < 2.12 */
# define _XOPEN_SOURCE 600
#endif
-#if !defined(_WIN32) && !defined(__sun)
+#if !defined(_POSIX_C_SOURCE) && !defined(_WIN32) && !defined(__sun)
/* POSIX APIs are needed */
# define _POSIX_C_SOURCE 200809L
#endif
diff --git a/Tests/Framework/CMakeLists.txt b/Tests/Framework/CMakeLists.txt
index a313c2c03..f741ec256 100644
--- a/Tests/Framework/CMakeLists.txt
+++ b/Tests/Framework/CMakeLists.txt
@@ -84,3 +84,19 @@ if(NOT XCODE OR NOT XCODE_VERSION VERSION_LESS 5)
endif()
include(CPack)
+
+if(APPLE)
+ set(ExternalFramework_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/External")
+ file(REMOVE_RECURSE "${ExternalFramework_INSTALL_DIR}")
+
+ include(ExternalProject)
+ ExternalProject_Add(ExternalFramework
+ SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/External"
+ INSTALL_DIR "${ExternalFramework_INSTALL_DIR}"
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
+ )
+
+ add_executable(useExternal useExternal.c)
+ target_link_libraries(useExternal PRIVATE "${ExternalFramework_INSTALL_DIR}/lib/External.framework")
+ add_dependencies(useExternal ExternalFramework)
+endif()
diff --git a/Tests/Framework/External/CMakeLists.txt b/Tests/Framework/External/CMakeLists.txt
new file mode 100644
index 000000000..b9128fd92
--- /dev/null
+++ b/Tests/Framework/External/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.19)
+project(ExternalFramework C)
+add_library(External SHARED external.c)
+set_property(TARGET External PROPERTY FRAMEWORK 1)
+install(TARGETS External DESTINATION lib)
diff --git a/Tests/Framework/External/external.c b/Tests/Framework/External/external.c
new file mode 100644
index 000000000..8441e71a0
--- /dev/null
+++ b/Tests/Framework/External/external.c
@@ -0,0 +1,4 @@
+int external(void)
+{
+ return 0;
+}
diff --git a/Tests/Framework/useExternal.c b/Tests/Framework/useExternal.c
new file mode 100644
index 000000000..8494b1506
--- /dev/null
+++ b/Tests/Framework/useExternal.c
@@ -0,0 +1,6 @@
+extern int external(void);
+
+int main(void)
+{
+ return external();
+}
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index 62163acd8..794274c3a 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -206,7 +206,7 @@ if(NOT XCODE_VERSION VERSION_LESS 7)
unset(RunCMake_TEST_OPTIONS)
endif()
-if(XCODE_VERSION VERSION_GREATER_EQUAL 6 AND XCODE_VERSION VERSION_LESS 12)
+if(XCODE_VERSION VERSION_GREATER_EQUAL 6)
# XcodeIOSInstallCombined
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombined-build)
set(RunCMake_TEST_NO_CLEAN 1)
@@ -220,7 +220,14 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 6 AND XCODE_VERSION VERSION_LESS 12)
run_cmake(XcodeIOSInstallCombined)
run_cmake_command(XcodeIOSInstallCombined-build ${CMAKE_COMMAND} --build .)
- run_cmake_command(XcodeIOSInstallCombined-install ${CMAKE_COMMAND} --build . --target install)
+ if(XCODE_VERSION VERSION_LESS 12)
+ run_cmake_command(XcodeIOSInstallCombined-install ${CMAKE_COMMAND} --build . --target install)
+ endif()
+ # --build defaults to Debug, --install defaults to Release, so we have to
+ # specify the configuration explicitly
+ run_cmake_command(XcodeIOSInstallCombined-cmakeinstall
+ ${CMAKE_COMMAND} --install . --config Debug
+ )
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
@@ -239,7 +246,14 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 6 AND XCODE_VERSION VERSION_LESS 12)
run_cmake(XcodeIOSInstallCombinedPrune)
run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .)
- run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install)
+ if(XCODE_VERSION VERSION_LESS 12)
+ run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install)
+ endif()
+ # --build defaults to Debug, --install defaults to Release, so we have to
+ # specify the configuration explicitly
+ run_cmake_command(XcodeIOSInstallCombinedPrune-cmakeinstall
+ ${CMAKE_COMMAND} --install . --config Debug
+ )
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
@@ -258,7 +272,14 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 6 AND XCODE_VERSION VERSION_LESS 12)
run_cmake(XcodeIOSInstallCombinedSingleArch)
run_cmake_command(XcodeIOSInstallCombinedSingleArch-build ${CMAKE_COMMAND} --build .)
- run_cmake_command(XcodeIOSInstallCombinedSingleArch-install ${CMAKE_COMMAND} --build . --target install)
+ if(XCODE_VERSION VERSION_LESS 12)
+ run_cmake_command(XcodeIOSInstallCombinedSingleArch-install ${CMAKE_COMMAND} --build . --target install)
+ endif()
+ # --build defaults to Debug, --install defaults to Release, so we have to
+ # specify the configuration explicitly
+ run_cmake_command(XcodeIOSInstallCombinedSingleArch-cmakeinstall
+ ${CMAKE_COMMAND} --install . --config Debug
+ )
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-cmakeinstall-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-cmakeinstall-check.cmake
new file mode 100644
index 000000000..a1ceb13b8
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-cmakeinstall-check.cmake
@@ -0,0 +1,2 @@
+# Expect the same results whether installing directly or via cmake --install
+include(${CMAKE_CURRENT_LIST_DIR}/XcodeIOSInstallCombined-install-check.cmake)
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake
new file mode 100644
index 000000000..3f7c37954
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake
@@ -0,0 +1,2 @@
+# Expect the same results whether installing directly or via cmake --install
+include(${CMAKE_CURRENT_LIST_DIR}/XcodeIOSInstallCombinedSingleArch-install-check.cmake)