Merge topic 'swift-rpath-darwin' into release-3.16
ff6c336127 Swift: support `-rpath` on Darwin
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4059
diff --git a/Help/command/target_precompile_headers.rst b/Help/command/target_precompile_headers.rst
index 5ab3766..569c7eb 100644
--- a/Help/command/target_precompile_headers.rst
+++ b/Help/command/target_precompile_headers.rst
@@ -3,33 +3,21 @@
Add a list of header files to precompile.
+Precompiling header files can speed up compilation by creating a partially
+processed version of some header files, and then using that version during
+compilations rather than repeatedly parsing the original headers.
+
+Main Form
+^^^^^^^^^
+
.. code-block:: cmake
target_precompile_headers(<target>
<INTERFACE|PUBLIC|PRIVATE> [header1...]
[<INTERFACE|PUBLIC|PRIVATE> [header2...] ...])
- target_precompile_headers(<target> REUSE_FROM <other_target>)
-
-Adds header files to :prop_tgt:`PRECOMPILE_HEADERS` or
-:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` target properties.
-
-The second signature will reuse an already precompiled header file artefact
-from another target. This is done by setting the
-:prop_tgt:`PRECOMPILE_HEADERS_REUSE_FROM` to ``<other_target>`` value.
-The ``<other_target>`` will become a dependency of ``<target>``.
-
-.. note::
-
- The second signature will require the same set of compiler options,
- compiler flags, compiler definitions for both ``<target>``, and
- ``<other_target>``. Compilers (e.g. GCC) will issue a warning if the
- precompiled header file cannot be used (``-Winvalid-pch``).
-
-Precompiling header files can speed up compilation by creating a partially
-processed version of some header files, and then using that version during
-compilations rather than repeatedly parsing the original headers.
-
+The command adds header files to the :prop_tgt:`PRECOMPILE_HEADERS` and/or
+:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` target properties of ``<target>``.
The named ``<target>`` must have been created by a command such as
:command:`add_executable` or :command:`add_library` and must not be an
:ref:`ALIAS target <Alias Targets>`.
@@ -38,32 +26,23 @@
specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC``
items will populate the :prop_tgt:`PRECOMPILE_HEADERS` property of
``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the
-:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` property of ``<target>``.
-(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.)
-Repeated calls for the same ``<target>`` append items in the order called.
+:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` property of ``<target>``
+(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items).
+Repeated calls for the same ``<target>`` will append items in the order called.
-Arguments to ``target_precompile_headers`` may use "generator expressions"
-with the syntax ``$<...>``.
-See the :manual:`cmake-generator-expressions(7)` manual for available
-expressions. See the :manual:`cmake-compile-features(7)` manual for
-information on compile features and a list of supported compilers.
-The ``$<COMPILE_LANGUAGE:...>`` generator expression is particularly
-useful for specifying a language-specific header to precompile for
-only one language (e.g. ``CXX`` and not ``C``).
-
-Usage
-^^^^^
-
-.. code-block:: cmake
-
- target_precompile_headers(<target>
- PUBLIC
- project_header.h
- "$<$<COMPILE_LANGUAGE:CXX>:cxx_only.h>"
- PRIVATE
- [["other_header.h"]]
- <unordered_map>
- )
+Projects should generally avoid using ``PUBLIC`` or ``INTERFACE`` for targets
+that will be :ref:`exported <install(EXPORT)>`, or they should at least use
+the ``$<BUILD_INTERFACE:...>`` generator expression to prevent precompile
+headers from appearing in an installed exported target. Consumers of a target
+should typically be in control of what precompile headers they use, not have
+precompile headers forced on them by the targets being consumed (since
+precompile headers are not typically usage requirements). A notable exception
+to this is where an :ref:`interface library <Interface Libraries>` is created
+to define a commonly used set of precompile headers in one place and then other
+targets link to that interface library privately. In this case, the interface
+library exists specifically to propagate the precompile headers to its
+consumers and the consumer is effectively still in control, since it decides
+whether to link to the interface library or not.
The list of header files is used to generate a header file named
``cmake_pch.h|xx`` which is used to generate the precompiled header file
@@ -79,6 +58,26 @@
source directory (e.g. :variable:`CMAKE_CURRENT_SOURCE_DIR`) and will be
included by absolute path.
+Arguments to ``target_precompile_headers()`` may use "generator expressions"
+with the syntax ``$<...>``.
+See the :manual:`cmake-generator-expressions(7)` manual for available
+expressions. See the :manual:`cmake-compile-features(7)` manual for
+information on compile features and a list of supported compilers.
+The ``$<COMPILE_LANGUAGE:...>`` generator expression is particularly
+useful for specifying a language-specific header to precompile for
+only one language (e.g. ``CXX`` and not ``C``). For example:
+
+.. code-block:: cmake
+
+ target_precompile_headers(myTarget
+ PUBLIC
+ project_header.h
+ "$<$<COMPILE_LANGUAGE:CXX>:cxx_only.h>"
+ PRIVATE
+ [["other_header.h"]]
+ <unordered_map>
+ )
+
When specifying angle brackets inside a :manual:`generator expression
<cmake-generator-expressions(7)>`, be sure to encode the closing ``>``
as ``$<ANGLE-R>``. For example:
@@ -88,13 +87,38 @@
target_precompile_headers(mylib PRIVATE
"$<$<COMPILE_LANGUAGE:C>:<stddef.h$<ANGLE-R>>"
"$<$<COMPILE_LANGUAGE:CXX>:<cstddef$<ANGLE-R>>"
- )
+ )
+
+
+Reusing Precompile Headers
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The command also supports a second signature which can be used to specify that
+one target re-uses a precompiled header file artefact from another target
+instead of generating its own:
+
+.. code-block:: cmake
+
+ target_precompile_headers(<target> REUSE_FROM <other_target>)
+
+This form sets the :prop_tgt:`PRECOMPILE_HEADERS_REUSE_FROM` property to
+``<other_target>`` and adds a dependency such that ``<target>`` will depend
+on ``<other_target>``. CMake will halt with an error if the
+:prop_tgt:`PRECOMPILE_HEADERS` property of ``<target>`` is already set when
+the ``REUSE_FROM`` form is used.
+
+.. note::
+
+ The ``REUSE_FROM`` form requires the same set of compiler options,
+ compiler flags and compiler definitions for both ``<target>`` and
+ ``<other_target>``. Some compilers (e.g. GCC) may issue a warning if the
+ precompiled header file cannot be used (``-Winvalid-pch``).
See Also
^^^^^^^^
-For disabling precompile headers for specific targets there is the
-property :prop_tgt:`DISABLE_PRECOMPILE_HEADERS`.
+To disable precompile headers for specific targets, see the
+:prop_tgt:`DISABLE_PRECOMPILE_HEADERS` target property.
-For skipping certain source files there is the source file property
-:prop_sf:`SKIP_PRECOMPILE_HEADERS`.
+To prevent precompile headers from being used when compiling a specific
+source file, see the :prop_sf:`SKIP_PRECOMPILE_HEADERS` source file property.
diff --git a/Help/guide/tutorial/index.rst b/Help/guide/tutorial/index.rst
index 3f20aa2..d74d160 100644
--- a/Help/guide/tutorial/index.rst
+++ b/Help/guide/tutorial/index.rst
@@ -610,12 +610,12 @@
run **cmake** or **cmake-gui** to configure the project, but do not build it
yet. Instead, change directory to the binary tree, and then run::
- ctest [-VV] –D Experimental
+ ctest [-VV] -D Experimental
Remember, for multi-config generators (e.g. Visual Studio), the configuration
type must be specified::
- ctest [-VV] -C Debug –D Experimental
+ ctest [-VV] -C Debug -D Experimental
Or, from an IDE, build the ``Experimental`` target.
diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst
index a821189..a14e322 100644
--- a/Help/manual/cmake-compile-features.7.rst
+++ b/Help/manual/cmake-compile-features.7.rst
@@ -28,10 +28,15 @@
or compile flags needed to use them.
Features known to CMake are named mostly following the same convention
-as the Clang feature test macros. The are some exceptions, such as
+as the Clang feature test macros. There are some exceptions, such as
CMake using ``cxx_final`` and ``cxx_override`` instead of the single
``cxx_override_control`` used by Clang.
+Note that there are no separate compile features properties or variables for
+the ``OBJC`` or ``OBJCXX`` languages. These are based off ``C`` or ``C++``
+respectively, so the properties and variables for their corresponding base
+language should be used instead.
+
Compile Feature Requirements
============================
diff --git a/Help/prop_tgt/INTERFACE_PRECOMPILE_HEADERS.rst b/Help/prop_tgt/INTERFACE_PRECOMPILE_HEADERS.rst
index 8ff7e8b..e285407 100644
--- a/Help/prop_tgt/INTERFACE_PRECOMPILE_HEADERS.rst
+++ b/Help/prop_tgt/INTERFACE_PRECOMPILE_HEADERS.rst
@@ -7,6 +7,8 @@
for consuming targets to precompile. The :command:`target_precompile_headers`
command populates this property with values given to the ``PUBLIC`` and
``INTERFACE`` keywords. Projects may also get and set the property directly.
+See the discussion in :command:`target_precompile_headers` for guidance on
+appropriate use of this property for installed or exported targets.
Contents of ``INTERFACE_PRECOMPILE_HEADERS`` may use "generator expressions"
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
index 7cd9b28..2c54da0 100644
--- a/Modules/CMakeSwiftInformation.cmake
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -77,7 +77,7 @@
endif()
if(NOT CMAKE_Swift_CREATE_SHARED_LIBRARY)
- set(CMAKE_Swift_CREATE_SHARED_LIBRARY "<CMAKE_Swift_COMPILER> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -j ${CMAKE_Swift_NUM_THREADS} -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <SONAME_FLAG> <TARGET_SONAME> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS} <LINK_LIBRARIES>")
+ set(CMAKE_Swift_CREATE_SHARED_LIBRARY "<CMAKE_Swift_COMPILER> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -j ${CMAKE_Swift_NUM_THREADS} -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS} <LINK_LIBRARIES>")
endif()
if(NOT CMAKE_Swift_CREATE_SHARED_MODULE)
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index 4fcc79d..1927aa4 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -105,6 +105,7 @@
endif()
if(UNIX)
list(APPEND PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES
+ "postgresql${suffix}"
"pgsql-${suffix}/lib")
list(APPEND PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES
"postgresql${suffix}"
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index fd69e21..12c68bb 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -243,22 +243,24 @@
#-------------------------------------------------------------------
#
# Get filename components for a configuration. For example,
- # if _CONFIGURATION = mswunivud, then _UNV=univ, _UCD=u _DBG=d
- # if _CONFIGURATION = mswu, then _UNV="", _UCD=u _DBG=""
+ # if _CONFIGURATION = mswunivud, then _PF="msw", _UNV=univ, _UCD=u _DBG=d
+ # if _CONFIGURATION = mswu, then _PF="msw", _UNV="", _UCD=u _DBG=""
#
- macro(WX_GET_NAME_COMPONENTS _CONFIGURATION _UNV _UCD _DBG)
+ macro(WX_GET_NAME_COMPONENTS _CONFIGURATION _PF _UNV _UCD _DBG)
+ DBG_MSG_V(${_CONFIGURATION})
string(REGEX MATCH "univ" ${_UNV} "${_CONFIGURATION}")
- string(REGEX REPLACE "msw.*(u)[d]*$" "u" ${_UCD} "${_CONFIGURATION}")
+ string(REGEX REPLACE "[msw|qt].*(u)[d]*$" "u" ${_UCD} "${_CONFIGURATION}")
if(${_UCD} STREQUAL ${_CONFIGURATION})
set(${_UCD} "")
endif()
string(REGEX MATCH "d$" ${_DBG} "${_CONFIGURATION}")
+ string(REGEX MATCH "^[msw|qt]*" ${_PF} "${_CONFIGURATION}")
endmacro()
#
# Find libraries associated to a configuration.
#
- macro(WX_FIND_LIBS _UNV _UCD _DBG)
+ macro(WX_FIND_LIBS _PF _UNV _UCD _DBG)
DBG_MSG_V("m_unv = ${_UNV}")
DBG_MSG_V("m_ucd = ${_UCD}")
DBG_MSG_V("m_dbg = ${_DBG}")
@@ -310,13 +312,13 @@
# Find wxWidgets monolithic library.
find_library(WX_mono${_DBG}
NAMES
- wxmsw${_UNV}31${_UCD}${_DBG}
- wxmsw${_UNV}30${_UCD}${_DBG}
- wxmsw${_UNV}29${_UCD}${_DBG}
- wxmsw${_UNV}28${_UCD}${_DBG}
- wxmsw${_UNV}27${_UCD}${_DBG}
- wxmsw${_UNV}26${_UCD}${_DBG}
- wxmsw${_UNV}25${_UCD}${_DBG}
+ wx${_PF}${_UNV}31${_UCD}${_DBG}
+ wx${_PF}${_UNV}30${_UCD}${_DBG}
+ wx${_PF}${_UNV}29${_UCD}${_DBG}
+ wx${_PF}${_UNV}28${_UCD}${_DBG}
+ wx${_PF}${_UNV}27${_UCD}${_DBG}
+ wx${_PF}${_UNV}26${_UCD}${_DBG}
+ wx${_PF}${_UNV}25${_UCD}${_DBG}
PATHS ${WX_LIB_DIR}
NO_DEFAULT_PATH
)
@@ -327,13 +329,13 @@
stc ribbon propgrid webview)
find_library(WX_${LIB}${_DBG}
NAMES
- wxmsw${_UNV}31${_UCD}${_DBG}_${LIB}
- wxmsw${_UNV}30${_UCD}${_DBG}_${LIB}
- wxmsw${_UNV}29${_UCD}${_DBG}_${LIB}
- wxmsw${_UNV}28${_UCD}${_DBG}_${LIB}
- wxmsw${_UNV}27${_UCD}${_DBG}_${LIB}
- wxmsw${_UNV}26${_UCD}${_DBG}_${LIB}
- wxmsw${_UNV}25${_UCD}${_DBG}_${LIB}
+ wx${_PF}${_UNV}31${_UCD}${_DBG}_${LIB}
+ wx${_PF}${_UNV}30${_UCD}${_DBG}_${LIB}
+ wx${_PF}${_UNV}29${_UCD}${_DBG}_${LIB}
+ wx${_PF}${_UNV}28${_UCD}${_DBG}_${LIB}
+ wx${_PF}${_UNV}27${_UCD}${_DBG}_${LIB}
+ wx${_PF}${_UNV}26${_UCD}${_DBG}_${LIB}
+ wx${_PF}${_UNV}25${_UCD}${_DBG}_${LIB}
PATHS ${WX_LIB_DIR}
NO_DEFAULT_PATH
)
@@ -429,7 +431,7 @@
list(APPEND wxWidgets_LIBRARIES opengl32 glu32)
endif()
- list(APPEND wxWidgets_LIBRARIES winmm comctl32 oleacc rpcrt4 shlwapi version wsock32)
+ list(APPEND wxWidgets_LIBRARIES winmm comctl32 uuid oleacc uxtheme rpcrt4 shlwapi version wsock32)
endmacro()
#-------------------------------------------------------------------
@@ -514,6 +516,7 @@
if(BUILD_SHARED_LIBS)
find_path(wxWidgets_LIB_DIR
NAMES
+ qtu/wx/setup.h
msw/wx/setup.h
mswd/wx/setup.h
mswu/wx/setup.h
@@ -539,6 +542,7 @@
else()
find_path(wxWidgets_LIB_DIR
NAMES
+ qtu/wx/setup.h
msw/wx/setup.h
mswd/wx/setup.h
mswu/wx/setup.h
@@ -581,7 +585,7 @@
endif()
# Search for available configuration types.
- foreach(CFG mswunivud mswunivd mswud mswd mswunivu mswuniv mswu msw)
+ foreach(CFG mswunivud mswunivd mswud mswd mswunivu mswuniv mswu msw qt qtd qtu qtud)
set(WX_${CFG}_FOUND FALSE)
if(EXISTS ${WX_LIB_DIR}/${CFG})
list(APPEND WX_CONFIGURATION_LIST ${CFG})
@@ -621,7 +625,7 @@
endif()
# Get configuration parameters from the name.
- WX_GET_NAME_COMPONENTS(${wxWidgets_CONFIGURATION} UNV UCD DBG)
+ WX_GET_NAME_COMPONENTS(${wxWidgets_CONFIGURATION} PF UNV UCD DBG)
# Set wxWidgets lib setup include directory.
if(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h)
@@ -641,7 +645,7 @@
endif()
# Find wxWidgets libraries.
- WX_FIND_LIBS("${UNV}" "${UCD}" "${DBG}")
+ WX_FIND_LIBS("${PF}" "${UNV}" "${UCD}" "${DBG}")
if(WX_USE_REL_AND_DBG)
WX_FIND_LIBS("${UNV}" "${UCD}" "d")
endif()
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 5fdbeab..e71a38f 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -610,7 +610,7 @@
bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate()
{
- std::string wixTemplate = FindTemplate("Internal/CPack/WIX.template.in");
+ std::string wixTemplate = FindTemplate("WIX.template.in");
if (GetOption("CPACK_WIX_TEMPLATE") != 0) {
wixTemplate = GetOption("CPACK_WIX_TEMPLATE");
}
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 7a6c50b..9530227 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -23,6 +23,7 @@
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
#include "cmVersion.h"
#include "cmWorkingDirectory.h"
#include "cmXMLSafe.h"
@@ -1254,7 +1255,17 @@
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Look for template: " << (name ? name : "(NULL)")
<< std::endl);
+ // Search CMAKE_MODULE_PATH for a custom template.
std::string ffile = this->MakefileMap->GetModulesFile(name);
+ if (ffile.empty()) {
+ // Fall back to our internal builtin default.
+ ffile = cmStrCat(cmSystemTools::GetCMakeRoot(), "/Modules/Internal/CPack/",
+ name);
+ cmSystemTools::ConvertToUnixSlashes(ffile);
+ if (!cmSystemTools::FileExists(ffile)) {
+ ffile.clear();
+ }
+ }
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Found template: " << ffile << std::endl);
return ffile;
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index adea8ec..9bf72df 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -39,8 +39,7 @@
{
// TODO: Fix nsis to force out file name
- std::string nsisInFileName =
- this->FindTemplate("Internal/CPack/NSIS.template.in");
+ std::string nsisInFileName = this->FindTemplate("NSIS.template.in");
if (nsisInFileName.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPack error: Could not find NSIS installer template file."
@@ -48,7 +47,7 @@
return false;
}
std::string nsisInInstallOptions =
- this->FindTemplate("Internal/CPack/NSIS.InstallOptions.ini.in");
+ this->FindTemplate("NSIS.InstallOptions.ini.in");
if (nsisInInstallOptions.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPack error: Could not find NSIS installer options file."
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index cd65694..951c65f 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -240,7 +240,7 @@
const std::string& name, const std::string& dir,
const char* outputFileName /* = 0 */, bool copyOnly /* = false */)
{
- std::string inFName = cmStrCat("Internal/CPack/CPack.", name, ".in");
+ std::string inFName = cmStrCat("CPack.", name, ".in");
std::string inFileName = this->FindTemplate(inFName.c_str());
if (inFileName.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx
index 3e1a51b..dae5ec9 100644
--- a/Source/CPack/cmCPackPKGGenerator.cxx
+++ b/Source/CPack/cmCPackPKGGenerator.cxx
@@ -49,7 +49,7 @@
void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile)
{
std::string distributionTemplate =
- this->FindTemplate("Internal/CPack/CPack.distribution.dist.in");
+ this->FindTemplate("CPack.distribution.dist.in");
if (distributionTemplate.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find input file: " << distributionTemplate
@@ -300,7 +300,7 @@
outName = name.c_str();
}
- std::string inFName = cmStrCat("Internal/CPack/CPack.", name, ".in");
+ std::string inFName = cmStrCat("CPack.", name, ".in");
std::string inFileName = this->FindTemplate(inFName.c_str());
if (inFileName.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index bb0ed4f..a4a5e6f 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -27,8 +27,7 @@
{
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
- std::string inFile =
- this->FindTemplate("Internal/CPack/CPack.STGZ_Header.sh.in");
+ std::string inFile = this->FindTemplate("CPack.STGZ_Header.sh.in");
if (inFile.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find template file: " << inFile << std::endl);
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index d38e9e1..171c3ed 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3344,19 +3344,20 @@
if (this->GetPropertyAsBool("DISABLE_PRECOMPILE_HEADERS")) {
return std::string();
}
+ const cmGeneratorTarget* generatorTarget = this;
+ const char* pchReuseFrom =
+ generatorTarget->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
+
const auto inserted =
this->PchHeaders.insert(std::make_pair(language + config, ""));
if (inserted.second) {
const std::vector<BT<std::string>> headers =
this->GetPrecompileHeaders(config, language);
- if (headers.empty()) {
+ if (headers.empty() && !pchReuseFrom) {
return std::string();
}
std::string& filename = inserted.first->second;
- const cmGeneratorTarget* generatorTarget = this;
- const char* pchReuseFrom =
- generatorTarget->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
if (pchReuseFrom) {
generatorTarget =
this->GetGlobalGenerator()->FindGeneratorTarget(pchReuseFrom);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index b79eb1d..923d2a5 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -693,6 +693,16 @@
configNames.emplace_back();
}
+ using LanguagePair = std::pair<std::string, std::string>;
+ std::vector<LanguagePair> pairedLanguages{ { "OBJC", "C" },
+ { "OBJCXX", "CXX" } };
+ std::set<LanguagePair> objcEnabledLanguages;
+ for (auto const& lang : pairedLanguages) {
+ if (this->Makefile->GetState()->GetLanguageEnabled(lang.first)) {
+ objcEnabledLanguages.insert(lang);
+ }
+ }
+
// Process compile features of all targets.
const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
for (cmGeneratorTarget* target : targets) {
@@ -701,6 +711,40 @@
return false;
}
}
+
+ // Now that C/C++ _STANDARD values have been computed
+ // set the values to ObjC/ObjCXX _STANDARD variables
+ if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
+ auto copyStandardToObjLang = [&](LanguagePair const& lang) -> bool {
+ if (!target->GetProperty(cmStrCat(lang.first, "_STANDARD"))) {
+ auto* standard =
+ target->GetProperty(cmStrCat(lang.second, "_STANDARD"));
+ if (!standard) {
+ standard = this->Makefile->GetDefinition(
+ cmStrCat("CMAKE_", lang.second, "_STANDARD_DEFAULT"));
+ }
+ target->Target->SetProperty(cmStrCat(lang.first, "_STANDARD"),
+ standard);
+ return true;
+ }
+ return false;
+ };
+ auto copyPropertyToObjLang = [&](LanguagePair const& lang,
+ const char* property) {
+ if (!target->GetProperty(cmStrCat(lang.first, property)) &&
+ target->GetProperty(cmStrCat(lang.second, property))) {
+ target->Target->SetProperty(
+ cmStrCat(lang.first, property),
+ target->GetProperty(cmStrCat(lang.second, property)));
+ }
+ };
+ for (auto const& lang : objcEnabledLanguages) {
+ if (copyStandardToObjLang(lang)) {
+ copyPropertyToObjLang(lang, "_STANDARD_REQUIRED");
+ copyPropertyToObjLang(lang, "_EXTENSIONS");
+ }
+ }
+ }
}
return true;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 99c16f2..2db89de 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1288,11 +1288,8 @@
reusedTarget->SetProperty("COMPILE_PDB_OUTPUT_DIRECTORY",
cmStrCat(reusedFrom, ".dir/").c_str());
- for (auto p : { "COMPILE_PDB_NAME", "PRECOMPILE_HEADERS",
- "INTERFACE_PRECOMPILE_HEADERS" }) {
- this->SetProperty(p, reusedTarget->GetProperty(p));
- }
-
+ this->SetProperty("COMPILE_PDB_NAME",
+ reusedTarget->GetProperty("COMPILE_PDB_NAME"));
this->AddUtility(reusedFrom, impl->Makefile);
} else {
impl->Properties.SetProperty(prop, value);
diff --git a/Tests/CMakeLib/testOptional.cxx b/Tests/CMakeLib/testOptional.cxx
index 3050332..c6bc9c2 100644
--- a/Tests/CMakeLib/testOptional.cxx
+++ b/Tests/CMakeLib/testOptional.cxx
@@ -240,7 +240,7 @@
expected = {
{ Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 },
- { Event::MOVE_CONSTRUCT, &*o2, &o1.value(), 4 },
+ { Event::MOVE_CONSTRUCT, &*o2, &*o1, 4 },
{ Event::DESTRUCT, &*o2, nullptr, 4 },
{ Event::DESTRUCT, &*o1, nullptr, 4 },
};
@@ -250,13 +250,14 @@
static bool testNulloptAssign(std::vector<Event>& expected)
{
cm::optional<EventLogger> o1{ 4 };
+ auto const* v1 = &*o1;
o1 = cm::nullopt;
cm::optional<EventLogger> o2{};
o2 = cm::nullopt;
expected = {
- { Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 },
- { Event::DESTRUCT, &*o1, nullptr, 4 },
+ { Event::VALUE_CONSTRUCT, v1, nullptr, 4 },
+ { Event::DESTRUCT, v1, nullptr, 4 },
};
return true;
}
@@ -265,8 +266,11 @@
{
cm::optional<EventLogger> o1{};
const cm::optional<EventLogger> o2{ 4 };
+ auto const* v2 = &*o2;
o1 = o2;
+ auto const* v1 = &*o1;
const cm::optional<EventLogger> o3{ 5 };
+ auto const* v3 = &*o3;
o1 = o3;
const cm::optional<EventLogger> o4{};
o1 = o4;
@@ -274,13 +278,13 @@
// an empty optional
expected = {
- { Event::VALUE_CONSTRUCT, &*o2, nullptr, 4 },
- { Event::COPY_CONSTRUCT, &*o1, &*o2, 4 },
- { Event::VALUE_CONSTRUCT, &*o3, nullptr, 5 },
- { Event::COPY_ASSIGN, &*o1, &*o3, 5 },
- { Event::DESTRUCT, &*o1, nullptr, 5 },
- { Event::DESTRUCT, &o3.value(), nullptr, 5 },
- { Event::DESTRUCT, &o2.value(), nullptr, 4 },
+ { Event::VALUE_CONSTRUCT, v2, nullptr, 4 },
+ { Event::COPY_CONSTRUCT, v1, v2, 4 },
+ { Event::VALUE_CONSTRUCT, v3, nullptr, 5 },
+ { Event::COPY_ASSIGN, v1, v3, 5 },
+ { Event::DESTRUCT, v1, nullptr, 5 },
+ { Event::DESTRUCT, v3, nullptr, 5 },
+ { Event::DESTRUCT, v2, nullptr, 4 },
};
return true;
}
@@ -289,20 +293,23 @@
{
cm::optional<EventLogger> o1{};
cm::optional<EventLogger> o2{ 4 };
+ auto const* v2 = &*o2;
o1 = std::move(o2);
+ auto const* v1 = &*o1;
cm::optional<EventLogger> o3{ 5 };
+ auto const* v3 = &*o3;
o1 = std::move(o3);
cm::optional<EventLogger> o4{};
o1 = std::move(o4);
expected = {
- { Event::VALUE_CONSTRUCT, &*o2, nullptr, 4 },
- { Event::MOVE_CONSTRUCT, &*o1, &*o2, 4 },
- { Event::VALUE_CONSTRUCT, &*o3, nullptr, 5 },
- { Event::MOVE_ASSIGN, &*o1, &*o3, 5 },
- { Event::DESTRUCT, &*o1, nullptr, 5 },
- { Event::DESTRUCT, &*o3, nullptr, 5 },
- { Event::DESTRUCT, &*o2, nullptr, 4 },
+ { Event::VALUE_CONSTRUCT, v2, nullptr, 4 },
+ { Event::MOVE_CONSTRUCT, v1, v2, 4 },
+ { Event::VALUE_CONSTRUCT, v3, nullptr, 5 },
+ { Event::MOVE_ASSIGN, v1, v3, 5 },
+ { Event::DESTRUCT, v1, nullptr, 5 },
+ { Event::DESTRUCT, v3, nullptr, 5 },
+ { Event::DESTRUCT, v2, nullptr, 4 },
};
return true;
}
@@ -333,7 +340,9 @@
static bool testDereference(std::vector<Event>& expected)
{
cm::optional<EventLogger> o1{ 4 };
+ auto const* v1 = &*o1;
const cm::optional<EventLogger> o2{ 5 };
+ auto const* v2 = &*o2;
(*o1).Reference();
(*o2).Reference();
@@ -343,16 +352,16 @@
#endif
expected = {
- { Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 },
- { Event::VALUE_CONSTRUCT, &*o2, nullptr, 5 },
- { Event::REFERENCE, &*o1, nullptr, 4 },
- { Event::CONST_REFERENCE, &*o2, nullptr, 5 },
- { Event::RVALUE_REFERENCE, &*o1, nullptr, 4 },
+ { Event::VALUE_CONSTRUCT, v1, nullptr, 4 },
+ { Event::VALUE_CONSTRUCT, v2, nullptr, 5 },
+ { Event::REFERENCE, v1, nullptr, 4 },
+ { Event::CONST_REFERENCE, v2, nullptr, 5 },
+ { Event::RVALUE_REFERENCE, v1, nullptr, 4 },
#ifdef ALLOW_CONST_RVALUE
- { Event::CONST_RVALUE_REFERENCE, &*o2, nullptr, 5 },
+ { Event::CONST_RVALUE_REFERENCE, v2, nullptr, 5 },
#endif
- { Event::DESTRUCT, &*o2, nullptr, 5 },
- { Event::DESTRUCT, &*o1, nullptr, 4 },
+ { Event::DESTRUCT, v2, nullptr, 5 },
+ { Event::DESTRUCT, v1, nullptr, 4 },
};
return true;
}
@@ -479,9 +488,11 @@
bool retval = true;
cm::optional<EventLogger> o1{ 4 };
+ auto const* v1 = &*o1;
cm::optional<EventLogger> o2{};
o1.swap(o2);
+ auto const* v2 = &*o2;
if (o1.has_value()) {
std::cout << "o1 should not have value" << std::endl;
@@ -545,15 +556,15 @@
}
expected = {
- { Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 },
- { Event::MOVE_CONSTRUCT, &*o2, &*o1, 4 },
- { Event::DESTRUCT, &*o1, nullptr, 4 },
- { Event::MOVE_CONSTRUCT, &*o1, &*o2, 4 },
- { Event::DESTRUCT, &*o2, nullptr, 4 },
- { Event::VALUE_CONSTRUCT, &*o2, nullptr, 5 },
- { Event::SWAP, &*o1, &*o2, 5 },
- { Event::DESTRUCT, &*o1, nullptr, 5 },
- { Event::DESTRUCT, &*o2, nullptr, 4 },
+ { Event::VALUE_CONSTRUCT, v1, nullptr, 4 },
+ { Event::MOVE_CONSTRUCT, v2, v1, 4 },
+ { Event::DESTRUCT, v1, nullptr, 4 },
+ { Event::MOVE_CONSTRUCT, v1, v2, 4 },
+ { Event::DESTRUCT, v2, nullptr, 4 },
+ { Event::VALUE_CONSTRUCT, v2, nullptr, 5 },
+ { Event::SWAP, v1, v2, 5 },
+ { Event::DESTRUCT, v1, nullptr, 5 },
+ { Event::DESTRUCT, v2, nullptr, 4 },
};
return retval;
}
@@ -563,6 +574,7 @@
bool retval = true;
cm::optional<EventLogger> o{ 4 };
+ auto const* v = &*o;
o.reset();
@@ -574,8 +586,8 @@
o.reset();
expected = {
- { Event::VALUE_CONSTRUCT, &*o, nullptr, 4 },
- { Event::DESTRUCT, &*o, nullptr, 4 },
+ { Event::VALUE_CONSTRUCT, v, nullptr, 4 },
+ { Event::DESTRUCT, v, nullptr, 4 },
};
return retval;
}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index b29638b..57fa7fc 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2327,92 +2327,8 @@
-P ${CMake_SOURCE_DIR}/Tests/CFBundleTest/VerifyResult.cmake)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CFBundleTest")
- ADD_TEST_MACRO(ObjC++ ObjC++)
-
- add_test(Objective-C.simple-build-test ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Objective-C/simple-build-test"
- "${CMake_BINARY_DIR}/Tests/Objective-C/simple-build-test"
- --build-two-config
- ${build_generator_args}
- --build-project simple-build-test
- --build-options ${build_options}
- --test-command simple-build-test
- )
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C/simple-build-test")
-
- add_test(Objective-C.c-file-extension-test ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Objective-C/c-file-extension-test"
- "${CMake_BINARY_DIR}/Tests/Objective-C/c-file-extension-test"
- --build-two-config
- ${build_generator_args}
- --build-project c-file-extension-test
- --build-options ${build_options}
- --test-command c-file-extension-test
- )
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C/c-file-extension-test")
-
- add_test(Objective-C.cxx-file-extension-test ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Objective-C/cxx-file-extension-test"
- "${CMake_BINARY_DIR}/Tests/Objective-C/cxx-file-extension-test"
- --build-two-config
- ${build_generator_args}
- --build-project cxx-file-extension-test
- --build-options ${build_options}
- --test-command cxx-file-extension-test
- )
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C/cxx-file-extension-test")
-
- add_test(Objective-C.objc-file-extension-test ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Objective-C/objc-file-extension-test"
- "${CMake_BINARY_DIR}/Tests/Objective-C/objc-file-extension-test"
- --build-two-config
- ${build_generator_args}
- --build-project objc-file-extension-test
- --build-options ${build_options}
- --test-command objc-file-extension-test
- )
- list(APPEND TEST_BUILD_DIRS "${CMAKE_BINARY_DIR}/Tests/Objective-C/objc-file-extension-test")
-
- add_test(Objective-CXX.simple-build-test ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Objective-C++/simple-build-test"
- "${CMake_BINARY_DIR}/Tests/Objective-C++/simple-build-test"
- --build-two-config
- ${build_generator_args}
- --build-project simple-build-test
- --build-options ${build_options}
- --test-command simple-build-test
- )
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C++/simple-build-test")
-
- add_test(Objective-CXX.cxx-file-extension-test ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Objective-C++/cxx-file-extension-test"
- "${CMake_BINARY_DIR}/Tests/Objective-C++/cxx-file-extension-test"
- --build-two-config
- ${build_generator_args}
- --build-project cxx-file-extension-test
- --build-options ${build_options}
- --test-command cxx-file-extension-test
- )
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C++/cxx-file-extension-test")
-
- add_test(Objective-CXX.objcxx-file-extension-test ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Objective-C++/objcxx-file-extension-test"
- "${CMake_BINARY_DIR}/Tests/Objective-C++/objcxx-file-extension-test"
- --build-two-config
- ${build_generator_args}
- --build-project objcxx-file-extension-test
- --build-options ${build_options}
- --test-command objcxx-file-extension-test
- )
- list(APPEND TEST_BUILD_DIRS "${CMAKE_BINARY_DIR}/Tests/Objective-C++/objcxx-file-extension-test")
-
+ add_subdirectory(ObjC)
+ add_subdirectory(ObjCXX)
endif ()
endif ()
diff --git a/Tests/ObjC/CMakeLists.txt b/Tests/ObjC/CMakeLists.txt
new file mode 100644
index 0000000..ce3033c
--- /dev/null
+++ b/Tests/ObjC/CMakeLists.txt
@@ -0,0 +1,4 @@
+ADD_TEST_MACRO(ObjC.simple-build-test simple-build-test)
+ADD_TEST_MACRO(ObjC.c-file-extension-test c-file-extension-test)
+ADD_TEST_MACRO(ObjC.cxx-file-extension-test cxx-file-extension-test)
+ADD_TEST_MACRO(ObjC.objc-file-extension-test objc-file-extension-test)
diff --git a/Tests/Objective-C/c-file-extension-test/CMakeLists.txt b/Tests/ObjC/c-file-extension-test/CMakeLists.txt
similarity index 100%
rename from Tests/Objective-C/c-file-extension-test/CMakeLists.txt
rename to Tests/ObjC/c-file-extension-test/CMakeLists.txt
diff --git a/Tests/Objective-C/c-file-extension-test/main.m b/Tests/ObjC/c-file-extension-test/main.m
similarity index 100%
rename from Tests/Objective-C/c-file-extension-test/main.m
rename to Tests/ObjC/c-file-extension-test/main.m
diff --git a/Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt b/Tests/ObjC/cxx-file-extension-test/CMakeLists.txt
similarity index 100%
rename from Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt
rename to Tests/ObjC/cxx-file-extension-test/CMakeLists.txt
diff --git a/Tests/Objective-C/cxx-file-extension-test/main.m b/Tests/ObjC/cxx-file-extension-test/main.m
similarity index 100%
rename from Tests/Objective-C/cxx-file-extension-test/main.m
rename to Tests/ObjC/cxx-file-extension-test/main.m
diff --git a/Tests/Objective-C/objc-file-extension-test/CMakeLists.txt b/Tests/ObjC/objc-file-extension-test/CMakeLists.txt
similarity index 100%
rename from Tests/Objective-C/objc-file-extension-test/CMakeLists.txt
rename to Tests/ObjC/objc-file-extension-test/CMakeLists.txt
diff --git a/Tests/Objective-C/objc-file-extension-test/main.m b/Tests/ObjC/objc-file-extension-test/main.m
similarity index 100%
rename from Tests/Objective-C/objc-file-extension-test/main.m
rename to Tests/ObjC/objc-file-extension-test/main.m
diff --git a/Tests/Objective-C/simple-build-test/CMakeLists.txt b/Tests/ObjC/simple-build-test/CMakeLists.txt
similarity index 100%
rename from Tests/Objective-C/simple-build-test/CMakeLists.txt
rename to Tests/ObjC/simple-build-test/CMakeLists.txt
diff --git a/Tests/Objective-C/simple-build-test/foo.h b/Tests/ObjC/simple-build-test/foo.h
similarity index 100%
rename from Tests/Objective-C/simple-build-test/foo.h
rename to Tests/ObjC/simple-build-test/foo.h
diff --git a/Tests/Objective-C/simple-build-test/foo.m b/Tests/ObjC/simple-build-test/foo.m
similarity index 100%
rename from Tests/Objective-C/simple-build-test/foo.m
rename to Tests/ObjC/simple-build-test/foo.m
diff --git a/Tests/Objective-C/simple-build-test/main.m b/Tests/ObjC/simple-build-test/main.m
similarity index 100%
rename from Tests/Objective-C/simple-build-test/main.m
rename to Tests/ObjC/simple-build-test/main.m
diff --git a/Tests/ObjCXX/CMakeLists.txt b/Tests/ObjCXX/CMakeLists.txt
new file mode 100644
index 0000000..a2a907a
--- /dev/null
+++ b/Tests/ObjCXX/CMakeLists.txt
@@ -0,0 +1,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)
diff --git a/Tests/ObjC++/CMakeLists.txt b/Tests/ObjCXX/ObjC++/CMakeLists.txt
similarity index 99%
rename from Tests/ObjC++/CMakeLists.txt
rename to Tests/ObjCXX/ObjC++/CMakeLists.txt
index 8b1563e..5ba5db2 100644
--- a/Tests/ObjC++/CMakeLists.txt
+++ b/Tests/ObjCXX/ObjC++/CMakeLists.txt
@@ -3,4 +3,3 @@
add_executable (ObjC++ objc++.mm)
target_link_libraries(ObjC++ "-framework Cocoa")
-
diff --git a/Tests/ObjC++/objc++.mm b/Tests/ObjCXX/ObjC++/objc++.mm
similarity index 100%
rename from Tests/ObjC++/objc++.mm
rename to Tests/ObjCXX/ObjC++/objc++.mm
diff --git a/Tests/Objective-C++/cxx-file-extension-test/CMakeLists.txt b/Tests/ObjCXX/cxx-file-extension-test/CMakeLists.txt
similarity index 100%
rename from Tests/Objective-C++/cxx-file-extension-test/CMakeLists.txt
rename to Tests/ObjCXX/cxx-file-extension-test/CMakeLists.txt
diff --git a/Tests/Objective-C++/cxx-file-extension-test/main.mm b/Tests/ObjCXX/cxx-file-extension-test/main.mm
similarity index 100%
rename from Tests/Objective-C++/cxx-file-extension-test/main.mm
rename to Tests/ObjCXX/cxx-file-extension-test/main.mm
diff --git a/Tests/Objective-C++/objcxx-file-extension-test/CMakeLists.txt b/Tests/ObjCXX/objcxx-file-extension-test/CMakeLists.txt
similarity index 100%
rename from Tests/Objective-C++/objcxx-file-extension-test/CMakeLists.txt
rename to Tests/ObjCXX/objcxx-file-extension-test/CMakeLists.txt
diff --git a/Tests/Objective-C++/objcxx-file-extension-test/main.mm b/Tests/ObjCXX/objcxx-file-extension-test/main.mm
similarity index 100%
rename from Tests/Objective-C++/objcxx-file-extension-test/main.mm
rename to Tests/ObjCXX/objcxx-file-extension-test/main.mm
diff --git a/Tests/Objective-C++/simple-build-test/CMakeLists.txt b/Tests/ObjCXX/simple-build-test/CMakeLists.txt
similarity index 100%
rename from Tests/Objective-C++/simple-build-test/CMakeLists.txt
rename to Tests/ObjCXX/simple-build-test/CMakeLists.txt
diff --git a/Tests/Objective-C/simple-build-test/foo.h b/Tests/ObjCXX/simple-build-test/foo.h
similarity index 100%
copy from Tests/Objective-C/simple-build-test/foo.h
copy to Tests/ObjCXX/simple-build-test/foo.h
diff --git a/Tests/Objective-C++/simple-build-test/foo.mm b/Tests/ObjCXX/simple-build-test/foo.mm
similarity index 100%
rename from Tests/Objective-C++/simple-build-test/foo.mm
rename to Tests/ObjCXX/simple-build-test/foo.mm
diff --git a/Tests/Objective-C++/simple-build-test/main.mm b/Tests/ObjCXX/simple-build-test/main.mm
similarity index 100%
rename from Tests/Objective-C++/simple-build-test/main.mm
rename to Tests/ObjCXX/simple-build-test/main.mm
diff --git a/Tests/Objective-C++/simple-build-test/foo.h b/Tests/Objective-C++/simple-build-test/foo.h
deleted file mode 100644
index b3fb084..0000000
--- a/Tests/Objective-C++/simple-build-test/foo.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#import <Foundation/Foundation.h>
-
-@interface Foo : NSObject {
- NSNumber* age;
-}
-
-@property (nonatomic, retain) NSNumber* age;
-
-@end
diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
index 4502456..03a97ed 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
@@ -1,8 +1,12 @@
cmake_minimum_required(VERSION 3.15)
project(PchReuseFrom C)
+if(CMAKE_C_COMPILE_OPTIONS_USE_PCH)
+ add_definitions(-DHAVE_PCH_SUPPORT)
+endif()
+
add_library(empty empty.c)
-target_precompile_headers(empty PUBLIC
+target_precompile_headers(empty PRIVATE
<stdio.h>
<string.h>
)
@@ -12,6 +16,9 @@
target_include_directories(foo PUBLIC include)
target_precompile_headers(foo REUSE_FROM empty)
+# should not cause problems if configured multiple times
+target_precompile_headers(foo REUSE_FROM empty)
+
add_executable(foobar foobar.c)
target_link_libraries(foobar foo )
set_target_properties(foobar PROPERTIES PRECOMPILE_HEADERS_REUSE_FROM foo)
diff --git a/Tests/RunCMake/PrecompileHeaders/foobar.c b/Tests/RunCMake/PrecompileHeaders/foobar.c
index 7a135ea..97d465c 100644
--- a/Tests/RunCMake/PrecompileHeaders/foobar.c
+++ b/Tests/RunCMake/PrecompileHeaders/foobar.c
@@ -4,5 +4,11 @@
int main()
{
- return foo() + foo2() + bar();
+ int zeroSize = 0;
+
+#ifdef HAVE_PCH_SUPPORT
+ zeroSize = (int)strlen("");
+#endif
+
+ return foo() + foo2() + bar() + zeroSize;
}