diff options
-rw-r--r-- | Help/command/target_precompile_headers.rst | 122 | ||||
-rw-r--r-- | Help/guide/tutorial/index.rst | 4 | ||||
-rw-r--r-- | Help/manual/cmake-compile-features.7.rst | 7 | ||||
-rw-r--r-- | Help/prop_tgt/INTERFACE_PRECOMPILE_HEADERS.rst | 2 | ||||
-rw-r--r-- | Modules/CMakeSwiftInformation.cmake | 2 | ||||
-rw-r--r-- | Modules/FindPostgreSQL.cmake | 1 | ||||
-rw-r--r-- | Modules/FindwxWidgets.cmake | 50 | ||||
-rw-r--r-- | Source/CPack/WiX/cmCPackWIXGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/CPack/cmCPackOSXX11Generator.cxx | 2 | ||||
-rw-r--r-- | Source/CPack/cmCPackPKGGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/CPack/cmCPackSTGZGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 9 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 44 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 7 | ||||
-rw-r--r-- | Tests/CMakeLib/testOptional.cxx | 84 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 88 | ||||
-rw-r--r-- | Tests/ObjC/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/ObjC/c-file-extension-test/CMakeLists.txt (renamed from Tests/Objective-C/c-file-extension-test/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | Tests/ObjC/c-file-extension-test/main.m (renamed from Tests/Objective-C/cxx-file-extension-test/main.m) | 0 | ||||
-rw-r--r-- | Tests/ObjC/cxx-file-extension-test/CMakeLists.txt (renamed from Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | Tests/ObjC/cxx-file-extension-test/main.m (renamed from Tests/Objective-C/c-file-extension-test/main.m) | 0 | ||||
-rw-r--r-- | Tests/ObjC/objc-file-extension-test/CMakeLists.txt (renamed from Tests/Objective-C/objc-file-extension-test/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | Tests/ObjC/objc-file-extension-test/main.m (renamed from Tests/Objective-C/objc-file-extension-test/main.m) | 0 | ||||
-rw-r--r-- | Tests/ObjC/simple-build-test/CMakeLists.txt (renamed from Tests/Objective-C/simple-build-test/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | Tests/ObjC/simple-build-test/foo.h (renamed from Tests/Objective-C/simple-build-test/foo.h) | 0 | ||||
-rw-r--r-- | Tests/ObjC/simple-build-test/foo.m (renamed from Tests/Objective-C/simple-build-test/foo.m) | 0 | ||||
-rw-r--r-- | Tests/ObjC/simple-build-test/main.m (renamed from Tests/Objective-C/simple-build-test/main.m) | 0 | ||||
-rw-r--r-- | Tests/ObjCXX/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/ObjCXX/ObjC++/CMakeLists.txt (renamed from Tests/ObjC++/CMakeLists.txt) | 1 | ||||
-rw-r--r-- | Tests/ObjCXX/ObjC++/objc++.mm (renamed from Tests/ObjC++/objc++.mm) | 0 | ||||
-rw-r--r-- | Tests/ObjCXX/cxx-file-extension-test/CMakeLists.txt (renamed from Tests/Objective-C++/cxx-file-extension-test/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | Tests/ObjCXX/cxx-file-extension-test/main.mm (renamed from Tests/Objective-C++/cxx-file-extension-test/main.mm) | 0 | ||||
-rw-r--r-- | Tests/ObjCXX/objcxx-file-extension-test/CMakeLists.txt (renamed from Tests/Objective-C++/objcxx-file-extension-test/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | Tests/ObjCXX/objcxx-file-extension-test/main.mm (renamed from Tests/Objective-C++/objcxx-file-extension-test/main.mm) | 0 | ||||
-rw-r--r-- | Tests/ObjCXX/simple-build-test/CMakeLists.txt (renamed from Tests/Objective-C++/simple-build-test/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | Tests/ObjCXX/simple-build-test/foo.h (renamed from Tests/Objective-C++/simple-build-test/foo.h) | 0 | ||||
-rw-r--r-- | Tests/ObjCXX/simple-build-test/foo.mm (renamed from Tests/Objective-C++/simple-build-test/foo.mm) | 0 | ||||
-rw-r--r-- | Tests/ObjCXX/simple-build-test/main.mm (renamed from Tests/Objective-C++/simple-build-test/main.mm) | 0 | ||||
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake | 9 | ||||
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/foobar.c | 8 |
42 files changed, 254 insertions, 219 deletions
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 @@ target_precompile_headers 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,25 +26,50 @@ The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to 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. + +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 +(``.pch``, ``.gch``, ``.pchi``) artifact. The ``cmake_pch.h|xx`` header +file will be force included (``-include`` for GCC, ``/FI`` for MSVC) to +all source files, so sources do not need to have ``#include "pch.h"``. + +Header file names specified with angle brackets (e.g. ``<unordered_map>``) or +explicit double quotes (escaped for the :manual:`cmake-language(7)`, +e.g. ``[["other_header.h"]]``) will be treated as is, and include directories +must be available for the compiler to find them. Other header file names +(e.g. ``project_header.h``) are interpreted as being relative to the current +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" +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 -^^^^^ +only one language (e.g. ``CXX`` and not ``C``). For example: .. code-block:: cmake - target_precompile_headers(<target> + target_precompile_headers(myTarget PUBLIC project_header.h "$<$<COMPILE_LANGUAGE:CXX>:cxx_only.h>" @@ -65,20 +78,6 @@ Usage <unordered_map> ) -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 -(``.pch``, ``.gch``, ``.pchi``) artifact. The ``cmake_pch.h|xx`` header -file will be force included (``-include`` for GCC, ``/FI`` for MSVC) to -all source files, so sources do not need to have ``#include "pch.h"``. - -Header file names specified with angle brackets (e.g. ``<unordered_map>``) or -explicit double quotes (escaped for the :manual:`cmake-language(7)`, -e.g. ``[["other_header.h"]]``) will be treated as is, and include directories -must be available for the compiler to find them. Other header file names -(e.g. ``project_header.h``) are interpreted as being relative to the current -source directory (e.g. :variable:`CMAKE_CURRENT_SOURCE_DIR`) and will be -included by absolute path. - 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 @@ as ``$<ANGLE-R>``. For example: 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 @@ CTest will read in this file when it runs. To create a simple dashboard you can 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 @@ CMake knows are known to the compiler, regardless of language standard 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 @@ Targets may populate this property to publish the header files 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 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows) 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 @@ foreach(suffix ${PostgreSQL_KNOWN_VERSIONS}) 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 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") #------------------------------------------------------------------- # # 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 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") # 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 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") 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 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") 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(wxWidgets_FIND_STYLE STREQUAL "win32") 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 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") 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 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") 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 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") 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 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") 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 @@ std::string cmCPackWIXGenerator::GetRootFolderId() const 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 @@ std::string cmCPackGenerator::FindTemplate(const char* name) 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 @@ int cmCPackNSISGenerator::PackageFiles() { // 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 @@ int cmCPackNSISGenerator::PackageFiles() 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 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile( 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 @@ std::string cmCPackPKGGenerator::GetPackageName( 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 @@ bool cmCPackPKGGenerator::CopyResourcePlistFile(const std::string& name, 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 @@ int cmCPackSTGZGenerator::InitializeInternal() { 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 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config, 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 @@ bool cmLocalGenerator::ComputeTargetCompileFeatures() 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 @@ bool cmLocalGenerator::ComputeTargetCompileFeatures() 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 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) 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 @@ static bool testMoveConstruct(std::vector<Event>& expected) 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 testMoveConstruct(std::vector<Event>& expected) 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 @@ static bool testCopyAssign(std::vector<Event>& expected) { 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 @@ static bool testCopyAssign(std::vector<Event>& expected) // 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 @@ static bool testMoveAssign(std::vector<Event>& expected) { 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 testPointer(std::vector<Event>& expected) 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 @@ static bool testDereference(std::vector<Event>& expected) #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 @@ static bool testSwap(std::vector<Event>& expected) 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 @@ static bool testSwap(std::vector<Event>& expected) } 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 @@ static bool testReset(std::vector<Event>& expected) bool retval = true; cm::optional<EventLogger> o{ 4 }; + auto const* v = &*o; o.reset(); @@ -574,8 +586,8 @@ static bool testReset(std::vector<Event>& expected) 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 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH -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 index e091448..e091448 100644 --- a/Tests/Objective-C/c-file-extension-test/CMakeLists.txt +++ b/Tests/ObjC/c-file-extension-test/CMakeLists.txt diff --git a/Tests/Objective-C/cxx-file-extension-test/main.m b/Tests/ObjC/c-file-extension-test/main.m index 1c159a9..1c159a9 100644 --- a/Tests/Objective-C/cxx-file-extension-test/main.m +++ b/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 index eb065e4..eb065e4 100644 --- a/Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt +++ b/Tests/ObjC/cxx-file-extension-test/CMakeLists.txt diff --git a/Tests/Objective-C/c-file-extension-test/main.m b/Tests/ObjC/cxx-file-extension-test/main.m index 1c159a9..1c159a9 100644 --- a/Tests/Objective-C/c-file-extension-test/main.m +++ b/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 index 27e88be..27e88be 100644 --- a/Tests/Objective-C/objc-file-extension-test/CMakeLists.txt +++ b/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 index 2ec3917..2ec3917 100644 --- a/Tests/Objective-C/objc-file-extension-test/main.m +++ b/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 index 5ab46ac..5ab46ac 100644 --- a/Tests/Objective-C/simple-build-test/CMakeLists.txt +++ b/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 index b3fb084..b3fb084 100644 --- a/Tests/Objective-C/simple-build-test/foo.h +++ b/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 index 2d452a8..2d452a8 100644 --- a/Tests/Objective-C/simple-build-test/foo.m +++ b/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 index 970d554..970d554 100644 --- a/Tests/Objective-C/simple-build-test/main.m +++ b/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 index 8b1563e..5ba5db2 100644 --- a/Tests/ObjC++/CMakeLists.txt +++ b/Tests/ObjCXX/ObjC++/CMakeLists.txt @@ -3,4 +3,3 @@ project (ObjC++) add_executable (ObjC++ objc++.mm) target_link_libraries(ObjC++ "-framework Cocoa") - diff --git a/Tests/ObjC++/objc++.mm b/Tests/ObjCXX/ObjC++/objc++.mm index 258ebaa..258ebaa 100644 --- a/Tests/ObjC++/objc++.mm +++ b/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 index 0b33875..0b33875 100644 --- a/Tests/Objective-C++/cxx-file-extension-test/CMakeLists.txt +++ b/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 index 1c159a9..1c159a9 100644 --- a/Tests/Objective-C++/cxx-file-extension-test/main.mm +++ b/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 index eda7bba..eda7bba 100644 --- a/Tests/Objective-C++/objcxx-file-extension-test/CMakeLists.txt +++ b/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 index d4aa1bb..d4aa1bb 100644 --- a/Tests/Objective-C++/objcxx-file-extension-test/main.mm +++ b/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 index cf27683..cf27683 100644 --- a/Tests/Objective-C++/simple-build-test/CMakeLists.txt +++ b/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 index b3fb084..b3fb084 100644 --- a/Tests/Objective-C++/simple-build-test/foo.h +++ b/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 index 2d452a8..2d452a8 100644 --- a/Tests/Objective-C++/simple-build-test/foo.mm +++ b/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 index 7c85551..7c85551 100644 --- a/Tests/Objective-C++/simple-build-test/main.mm +++ b/Tests/ObjCXX/simple-build-test/main.mm 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 @@ add_library(foo foo.c) 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; } |