diff options
189 files changed, 2257 insertions, 1714 deletions
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index ac893c2..931363c 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -254,17 +254,22 @@ Properties on Targets /prop_tgt/TYPE /prop_tgt/VERSION /prop_tgt/VISIBILITY_INLINES_HIDDEN + /prop_tgt/VS_DESKTOP_EXTENSIONS_VERSION /prop_tgt/VS_DOTNET_REFERENCES /prop_tgt/VS_DOTNET_TARGET_FRAMEWORK_VERSION /prop_tgt/VS_GLOBAL_KEYWORD /prop_tgt/VS_GLOBAL_PROJECT_TYPES /prop_tgt/VS_GLOBAL_ROOTNAMESPACE /prop_tgt/VS_GLOBAL_variable + /prop_tgt/VS_IOT_EXTENSIONS_VERSION + /prop_tgt/VS_IOT_STARTUP_TASK /prop_tgt/VS_KEYWORD + /prop_tgt/VS_MOBILE_EXTENSIONS_VERSION /prop_tgt/VS_SCC_AUXPATH /prop_tgt/VS_SCC_LOCALPATH /prop_tgt/VS_SCC_PROJECTNAME /prop_tgt/VS_SCC_PROVIDER + /prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION /prop_tgt/VS_WINRT_COMPONENT /prop_tgt/VS_WINRT_EXTENSIONS /prop_tgt/VS_WINRT_REFERENCES diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst index a06dce7..492fcac 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -220,6 +220,23 @@ Windows CE to use. Currently version 8.0 (Windows Embedded Compact 2013) is supported out of the box. Other versions may require one to set :variable:`CMAKE_GENERATOR_TOOLSET` to the correct value. +Cross Compiling for Windows 10 Universal Applications +----------------------------------------------------- + +A toolchain file to configure a Visual Studio generator for a +Windows 10 Universal Application may look like this: + +.. code-block:: cmake + + set(CMAKE_SYSTEM_NAME WindowsStore) + set(CMAKE_SYSTEM_VERSION 10.0) + +A Windows 10 Universal Application targets both Windows Store and +Windows Phone. Specify the :variable:`CMAKE_SYSTEM_VERSION` variable +to be ``10.0`` to build with the latest available Windows 10 SDK. +Specify a more specific version (e.g. ``10.0.10240.0`` for RTM) +to build with the corresponding SDK. + Cross Compiling for Windows Phone --------------------------------- diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 635db00..2116900 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -82,6 +82,7 @@ Variables that Provide Information /variable/CMAKE_VS_NsightTegra_VERSION /variable/CMAKE_VS_PLATFORM_NAME /variable/CMAKE_VS_PLATFORM_TOOLSET + /variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION /variable/CMAKE_XCODE_PLATFORM_TOOLSET /variable/PROJECT_BINARY_DIR /variable/PROJECT-NAME_BINARY_DIR diff --git a/Help/prop_tgt/VS_DESKTOP_EXTENSIONS_VERSION.rst b/Help/prop_tgt/VS_DESKTOP_EXTENSIONS_VERSION.rst new file mode 100644 index 0000000..19d1620 --- /dev/null +++ b/Help/prop_tgt/VS_DESKTOP_EXTENSIONS_VERSION.rst @@ -0,0 +1,10 @@ +VS_DESKTOP_EXTENSIONS_VERSION +----------------------------- + +Visual Studio Windows 10 Desktop Extensions Version + +Specifies the version of the Desktop Extensions that should be included in the +target. For example ``10.0.10240.0``. If the value is not specified, the Desktop +Extensions will not be included. To use the same version of the extensions as +the Windows 10 SDK that is being used, you can use the +:variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION` variable. diff --git a/Help/prop_tgt/VS_IOT_EXTENSIONS_VERSION.rst b/Help/prop_tgt/VS_IOT_EXTENSIONS_VERSION.rst new file mode 100644 index 0000000..27c8a3d --- /dev/null +++ b/Help/prop_tgt/VS_IOT_EXTENSIONS_VERSION.rst @@ -0,0 +1,10 @@ +VS_IOT_EXTENSIONS_VERSION +------------------------- + +Visual Studio Windows 10 IoT Extensions Version + +Specifies the version of the IoT Extensions that should be included in the +target. For example ``10.0.10240.0``. If the value is not specified, the IoT +Extensions will not be included. To use the same version of the extensions as +the Windows 10 SDK that is being used, you can use the +:variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION` variable. diff --git a/Help/prop_tgt/VS_IOT_STARTUP_TASK.rst b/Help/prop_tgt/VS_IOT_STARTUP_TASK.rst new file mode 100644 index 0000000..add50cb --- /dev/null +++ b/Help/prop_tgt/VS_IOT_STARTUP_TASK.rst @@ -0,0 +1,6 @@ +VS_IOT_STARTUP_TASK +------------------- + +Visual Studio Windows 10 IoT Continuous Background Task + +Specifies that the target should be compiled as a Continuous Background Task library. diff --git a/Help/prop_tgt/VS_MOBILE_EXTENSIONS_VERSION.rst b/Help/prop_tgt/VS_MOBILE_EXTENSIONS_VERSION.rst new file mode 100644 index 0000000..be3c9a0 --- /dev/null +++ b/Help/prop_tgt/VS_MOBILE_EXTENSIONS_VERSION.rst @@ -0,0 +1,10 @@ +VS_MOBILE_EXTENSIONS_VERSION +---------------------------- + +Visual Studio Windows 10 Mobile Extensions Version + +Specifies the version of the Mobile Extensions that should be included in the +target. For example ``10.0.10240.0``. If the value is not specified, the Mobile +Extensions will not be included. To use the same version of the extensions as +the Windows 10 SDK that is being used, you can use the +:variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION` variable. diff --git a/Help/prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION.rst b/Help/prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION.rst new file mode 100644 index 0000000..1ad7a71 --- /dev/null +++ b/Help/prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION.rst @@ -0,0 +1,10 @@ +VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION +-------------------------------------- + +Visual Studio Windows Target Platform Minimum Version + +For Windows 10. Specifies the minimum version of the OS that is being +targeted. For example ``10.0.10240.0``. If the value is not specified, the +value of :variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION` will be used on +WindowsStore projects otherwise the target platform minimum version will not +be specified for the project. diff --git a/Help/release/3.4.rst b/Help/release/3.4.rst new file mode 100644 index 0000000..495391a --- /dev/null +++ b/Help/release/3.4.rst @@ -0,0 +1,269 @@ +CMake 3.4 Release Notes +*********************** + +.. only:: html + + .. contents:: + +Changes made since CMake 3.3 include the following. + +New Features +============ + +Generators +---------- + +* The :generator:`Visual Studio 14 2015` generator learned to select + a Windows 10 SDK based on the value of the :variable:`CMAKE_SYSTEM_VERSION` + variable and the SDKs available on the host. + +* CMake learned rudimentary support for the Apple Swift language. When using + the :generator:`Xcode` generator with Xcode 6.1 or higher, one may enable + the ``Swift`` language with the :command:`enable_language` command or the + :command:`project` command (this is an error with other generators or when + Xcode is too old). Then one may list ``.swift`` source files in targets + for compilation. + +Commands +-------- + +* The :command:`find_program` command learned a ``NAMES_PER_DIR`` + option to consider all given ``NAMES`` in each directory before + moving on to the next directory. + +* The :command:`get_filename_component` command learned a new ``BASE_DIR`` + subcommand. This is used to specify a base directory when calculating an + absolute path from a relative path. + +* The :command:`if` command learned a new ``TEST`` operator that evaluates + to true if a given test name has been defined by the :command:`add_test` + command. See policy :policy:`CMP0064`. + +* The :command:`install(DIRECTORY)` command ``DESTINATION`` option learned to + support :manual:`generator expressions <cmake-generator-expressions(7)>`. + +* The :command:`install(FILES)` command ``DESTINATION`` option learned to + support :manual:`generator expressions <cmake-generator-expressions(7)>`. + +* The :command:`string` command learned a new ``APPEND`` subcommand. + +Variables +--------- + +* The :ref:`Makefile Generators` and the :generator:`Ninja` generator + learned to add compiler launcher tools like distcc and ccache along + with the compiler for ``C`` and ``CXX`` languages. See the + :variable:`CMAKE_<LANG>_COMPILER_LAUNCHER` variable and + :prop_tgt:`<LANG>_COMPILER_LAUNCHER` target property for details. + +* New :variable:`CMAKE_LINK_SEARCH_START_STATIC` and + :variable:`CMAKE_LINK_SEARCH_END_STATIC` variables were + introduced to initialize the + :prop_tgt:`LINK_SEARCH_START_STATIC` and + :prop_tgt:`LINK_SEARCH_END_STATIC` target properties, + respectively. + +Properties +---------- + +* :ref:`Visual Studio Generators` learned to support additonal + target properties to customize projects for NVIDIA Nsight + Tegra Visual Studio Edition: + + * :prop_tgt:`ANDROID_ANT_ADDITIONAL_OPTIONS` + * :prop_tgt:`ANDROID_ARCH` + * :prop_tgt:`ANDROID_ASSETS_DIRECTORIES` + * :prop_tgt:`ANDROID_JAR_DEPENDENCIES` + * :prop_tgt:`ANDROID_JAR_DIRECTORIES` + * :prop_tgt:`ANDROID_JAVA_SOURCE_DIR` + * :prop_tgt:`ANDROID_NATIVE_LIB_DEPENDENCIES` + * :prop_tgt:`ANDROID_NATIVE_LIB_DIRECTORIES` + * :prop_tgt:`ANDROID_PROCESS_MAX` + * :prop_tgt:`ANDROID_PROGUARD` + * :prop_tgt:`ANDROID_PROGUARD_CONFIG_PATH` + * :prop_tgt:`ANDROID_SECURE_PROPS_PATH` + * :prop_tgt:`ANDROID_SKIP_ANT_STEP` + * :prop_tgt:`ANDROID_STL_TYPE` + +* The :prop_tgt:`ARCHIVE_OUTPUT_DIRECTORY`, + :prop_tgt:`LIBRARY_OUTPUT_DIRECTORY`, and + :prop_tgt:`RUNTIME_OUTPUT_DIRECTORY` target properties learned to + support :manual:`generator expressions <cmake-generator-expressions(7)>`. + +* The :prop_tgt:`SOURCE_DIR` and :prop_tgt:`BINARY_DIR` target properties + were introduced to allow project code to query where a target is defined. + +* The :prop_tgt:`OUTPUT_NAME` target property and its variants learned to + support :manual:`generator expressions <cmake-generator-expressions(7)>`. + +* A :prop_gbl:`TARGET_MESSAGES` global property was added to tell the + :ref:`Makefile Generators` whether to generate commands to print output + after each target is completed. + +* On Windows with MS-compatible tools, CMake learned to optionally + generate a module definition (``.def``) file for ``SHARED`` libraries. + See the :prop_tgt:`WINDOWS_EXPORT_ALL_SYMBOLS` target property. + +Modules +------- + +* The :module:`ExternalProject` module :command:`ExternalProject_Add` + function ``GIT_SUBMODULES`` option now also limits the set of + submodules that are initialized in addition to the prior behavior + of limiting the set of submodules that are updated. + +* The :module:`ExternalProject` module learned new ``USES_TERMINAL`` + arguments for giving steps exclusive terminal access. This is + useful with the :generator:`Ninja` generator to monitor CMake + superbuild progress and prevent CPU oversubscription. + +* The :module:`FindBISON` module ``BISON_TARGET`` macro learned a + new ``DEFINES_FILE`` option to specify a custom output header + to be generated. + +* The :module:`FindHDF5` module learend a new ``HDF5_PREFER_PARALLEL`` + option allowing users to specify that a parallel HDF5 tool is + preferred if both are available. + +* The :module:`FindIce` module now provides imported targets. + +* The :module:`FindJava` module learned to optionally find + the ``idlj`` and ``jarsigner`` tools. + +* The :module:`FindOpenSSL` module now provides imported targets. + +* The :module:`FindOpenSSL` module learned a new ``OPENSSL_USE_STATIC_LIBS`` + option to search only for static libraries. + +* The :module:`FindPkgConfig` learned a new :command:`pkg_get_variable` + command which may be used to query for arbitrary variables from a package + (such as for related tools or data and plugin install paths). + +* The :module:`FindProtobuf` module gained a new + :command:`protobuf_generate_python` function to generate python + sources from ``.proto`` files. + +* The :module:`FindTIFF` module learned to search separately for + debug and release variants. + +* The :module:`FindwxWidgets` module learned to support version requests. + +* The :module:`FindXercesC` module learned to search separately for + debug and release variants. + +* The :module:`FindZLIB` module learned to search separately for + debug and release variants. + +* The :module:`GNUInstallDirs` module learned special default values + for certain installation prefixes according to the `GNU Coding + Standards`_ and the `Filesystem Hierarchy Standard`_. + +* The :module:`UseJava` module ``add_jar`` function learned + to support response files (e.g. ``@srcs.txt``) for source + specification. + +* The :module:`UseJava` module ``install_jar`` function learned + new ``DESTINATION`` and ``COMPONENT`` options to specify + the corresponding :command:`install` command options. + +* The :module:`UseJava` module gained a new ``create_javah`` + function to create C headers from Java classes. + +.. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html +.. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html + +Generator Expressions +--------------------- + +* A new ``$<SHELL_PATH:...>`` + :manual:`generator expression <cmake-generator-expressions(7)>` + has been added. + +CTest +----- + +* CTest learned to optionally measure the CPU load during parallel + testing and avoid starting tests that may cause the load to exceed + a given threshold. See the :manual:`ctest(1)` command ``--test-load`` + option, the ``TestLoad`` setting of the :ref:`CTest Test Step`, + the :variable:`CTEST_TEST_LOAD` variable, and the ``TEST_LOAD`` + option of the :command:`ctest_test` command. + +* :manual:`ctest(1)` learned options + ``--test-output-size-passed`` and ``--test-output-size-failed`` + to customize the limit on test output size submitted when + running as a :ref:`Dashboard Client`. + +CPack +----- + +* The :module:`CPackDeb` module learned to set package dependencies + per component. See variables: + + * :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS` + * :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS` + * :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES` + * :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS` + * :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES` + * :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS` + * :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES` + * :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS` + +* The :module:`CPack` module learned to package empty directories. + +* The :module:`CPack` module gained a new setting, ``CPACK_VERBATIM_VARIABLES``, + which can be used to ensure the cpack program receives the settings' values + exactly as they were set, even if they contain CMake-special characters. + For compatibility, it's off by default. + +Other +----- + +* The :manual:`Compile Features <cmake-compile-features(7)>` functionality + is now aware of features supported by GNU C compilers on Windows. + +* CMake learned to honor ``*.manifest`` source files with MSVC tools. + Manifest files named as sources of ``.exe`` and ``.dll`` targets + will be merged with linker-generated manifests and embedded in the + binary. + +* The `Concurrent Fortran 77 <https://ccur.com>`__ compiler is now supported. + Its :variable:`compiler id <CMAKE_<LANG>_COMPILER_ID>` is ``CCur``. + +* :manual:`cmake(1)` gained a new ``--trace-expand`` command line option + that is like ``--trace`` but expands variable references in the output. + +Deprecated and Removed Features +=============================== + +* The :module:`CMakeExpandImportedTargets` module is now documented + as deprecated. See module documentation for an explanation. + +* The :variable:`CMAKE_USE_RELATIVE_PATHS` variable no longer has any + effect. Previously it was partially implemented and unreliable. + +Other Changes +============= + +* The :module:`CheckFunctionExists`, :module:`CheckLibraryExists`, + :module:`CheckSymbolExists`, and :module:`FindThreads` modules learned to + work in environments where only CXX is enabled. + +* The :module:`CPackDeb` module now correctly excludes symlinks during package + checksum calculation. + +* The :module:`CPackDeb` no longer uses fakeroot and system tar program for + packaging. + +* The :module:`CPack` module no longer mangles settings with CMake-special + characters when they're used as defaults for other settings. The macro + ``cpack_set_if_not_set``, which was responsible for this, is now deprecated. + +* CMake no longer links executables with flags to export symbols + unless the :prop_tgt:`ENABLE_EXPORTS` target property is set. + See policy :policy:`CMP0065`. + +* The ``SONAME`` field is no longer set for ``MODULE`` libraries + created with the :command:`add_library` command. ``MODULE`` + libraries are meant for explicit dynamic loading at runtime. + They cannot be linked so ``SONAME`` is not useful. diff --git a/Help/release/dev/CPack-updates.rst b/Help/release/dev/CPack-updates.rst deleted file mode 100644 index ea0780f..0000000 --- a/Help/release/dev/CPack-updates.rst +++ /dev/null @@ -1,11 +0,0 @@ -CPack-updates -------------- - -* The :module:`CPack` module no longer mangles settings with CMake-special - characters when they're used as defaults for other settings. The macro - ``cpack_set_if_not_set``, which was responsible for this, is now deprecated. - -* The :module:`CPack` module gained a new setting, ``CPACK_VERBATIM_VARIABLES``, - which can be used to ensure the cpack program receives the settings' values - exactly as they were set, even if they contain CMake-special characters. - For compatibility, it's off by default. diff --git a/Help/release/dev/ConcurrentFortran-compiler-id.rst b/Help/release/dev/ConcurrentFortran-compiler-id.rst deleted file mode 100644 index 71e79aa..0000000 --- a/Help/release/dev/ConcurrentFortran-compiler-id.rst +++ /dev/null @@ -1,5 +0,0 @@ -ConcurrentFortran-compiler-id ------------------------------ - -* The `Concurrent Fortran 77 <https://ccur.com>`__ compiler is now supported. - Its :variable:`compiler id <CMAKE_<LANG>_COMPILER_ID>` is ``CCur``. diff --git a/Help/release/dev/ExternalProject-USES_TERMINAL.rst b/Help/release/dev/ExternalProject-USES_TERMINAL.rst deleted file mode 100644 index 415540d..0000000 --- a/Help/release/dev/ExternalProject-USES_TERMINAL.rst +++ /dev/null @@ -1,7 +0,0 @@ -ExternalProject-USES_TERMINAL ------------------------------ - -* The :module:`ExternalProject` module learned new ``USES_TERMINAL`` - arguments for giving steps exclusive terminal access. Especially - useful with the :generator:`Ninja` generator to monitor CMake - superbuild progress and prevent CPU oversubscription. diff --git a/Help/release/dev/ExternalProject_init_selected_submodules.rst b/Help/release/dev/ExternalProject_init_selected_submodules.rst deleted file mode 100644 index e642c19..0000000 --- a/Help/release/dev/ExternalProject_init_selected_submodules.rst +++ /dev/null @@ -1,7 +0,0 @@ -ExternalProject_init_selected_submodules ----------------------------------------- - -* The :module:`ExternalProject` module :command:`ExternalProject_Add` - function ``GIT_SUBMODULES`` option now also limits the set of - submodules that are initialized in addition to the prior behavior - of limiting the set of submodules that are updated. diff --git a/Help/release/dev/ExternalProject_stash_save_all.rst b/Help/release/dev/ExternalProject_stash_save_all.rst deleted file mode 100644 index e00ed44..0000000 --- a/Help/release/dev/ExternalProject_stash_save_all.rst +++ /dev/null @@ -1,5 +0,0 @@ -ExternalProject_stash_save_all ------------------------------- - -* Use "git stash save --all" only if supported. The --all option for git-stash - wasn't introduced until git version 1.7.6. diff --git a/Help/release/dev/FindBISON-DEFINES_FILE.rst b/Help/release/dev/FindBISON-DEFINES_FILE.rst deleted file mode 100644 index 815d560..0000000 --- a/Help/release/dev/FindBISON-DEFINES_FILE.rst +++ /dev/null @@ -1,6 +0,0 @@ -FindBISON-DEFINES_FILE ----------------------- - -* The :module:`FindBISON` module ``BISON_TARGET`` macro learned a - new ``DEFINES_FILE`` option to specify a custom output header - to be generated. diff --git a/Help/release/dev/FindGTK2_sigc++_c++11.rst b/Help/release/dev/FindGTK2_sigc++_c++11.rst new file mode 100644 index 0000000..2ba1459 --- /dev/null +++ b/Help/release/dev/FindGTK2_sigc++_c++11.rst @@ -0,0 +1,7 @@ +FindGTK2_sigc++_c++11 +--------------------- + +* Starting with sigc++ 2.5.1, c++11 must be enabled in order to use + sigc++. The GTK2::sigc++ imported target will automatically enable the + required build flags in order to build with the version found on the + system. diff --git a/Help/release/dev/FindHDF5-updates.rst b/Help/release/dev/FindHDF5-updates.rst deleted file mode 100644 index a9297bb..0000000 --- a/Help/release/dev/FindHDF5-updates.rst +++ /dev/null @@ -1,6 +0,0 @@ -FindHDF5-updates ----------------- - -* The :module:`FindHDF5` module learend a new ``HDF5_PREFER_PARALLEL`` - option allowing users to specify that a parallel HDF5 tool is - preferred if both are available. diff --git a/Help/release/dev/FindIce-imported-targets.rst b/Help/release/dev/FindIce-imported-targets.rst deleted file mode 100644 index 7e1b2f4..0000000 --- a/Help/release/dev/FindIce-imported-targets.rst +++ /dev/null @@ -1,4 +0,0 @@ -FindIce-imported-targets ------------------------- - -* The :module:`FindIce` module now provides imported targets. diff --git a/Help/release/dev/FindOpenSSL-msvc-static-rt.rst b/Help/release/dev/FindOpenSSL-msvc-static-rt.rst new file mode 100644 index 0000000..6e0ee27 --- /dev/null +++ b/Help/release/dev/FindOpenSSL-msvc-static-rt.rst @@ -0,0 +1,6 @@ +FindOpenSSL-msvc-static-rt +-------------------------- + +* The :module:`FindOpenSSL` module gained a new + ``OPENSSL_MSVC_STATIC_RT`` option to search for libraries using + the MSVC static runtime. diff --git a/Help/release/dev/FindOpenSSL-static-libs.rst b/Help/release/dev/FindOpenSSL-static-libs.rst deleted file mode 100644 index 69ec6f2..0000000 --- a/Help/release/dev/FindOpenSSL-static-libs.rst +++ /dev/null @@ -1,5 +0,0 @@ -FindOpenSSL-static-libs ------------------------ - -* The :module:`FindOpenSSL` module learned a new ``OPENSSL_USE_STATIC_LIBS`` - option to search only for static libraries. diff --git a/Help/release/dev/FindProtobuf-python-extension.rst b/Help/release/dev/FindProtobuf-python-extension.rst deleted file mode 100644 index 95463bf..0000000 --- a/Help/release/dev/FindProtobuf-python-extension.rst +++ /dev/null @@ -1,6 +0,0 @@ -FindProtobuf-python-extension ------------------------------ - -* The :module:`FindProtobuf` module gained a new - :command:`protobuf_generate_python` function to generate python - sources from ``.proto`` files. diff --git a/Help/release/dev/FindTIFF-updates.rst b/Help/release/dev/FindTIFF-updates.rst deleted file mode 100644 index 083e40f..0000000 --- a/Help/release/dev/FindTIFF-updates.rst +++ /dev/null @@ -1,5 +0,0 @@ -FindTIFF-updates ----------------- - -* The :module:`FindTIFF` module learned to search separately for - debug and release variants. diff --git a/Help/release/dev/FindXercesC-updates.rst b/Help/release/dev/FindXercesC-updates.rst deleted file mode 100644 index 47a8ada..0000000 --- a/Help/release/dev/FindXercesC-updates.rst +++ /dev/null @@ -1,5 +0,0 @@ -FindXercesC-updates -------------------- - -* The :module:`FindXercesC` module learned to search separately for - debug and release variants. diff --git a/Help/release/dev/FindZLIB-per-config.rst b/Help/release/dev/FindZLIB-per-config.rst deleted file mode 100644 index 97fd6ef..0000000 --- a/Help/release/dev/FindZLIB-per-config.rst +++ /dev/null @@ -1,5 +0,0 @@ -FindZLIB-per-config -------------------- - -* The :module:`FindZLIB` module learned to search separately for - debug and release variants. diff --git a/Help/release/dev/FindwxWidgets-updates.rst b/Help/release/dev/FindwxWidgets-updates.rst deleted file mode 100644 index aa470f2..0000000 --- a/Help/release/dev/FindwxWidgets-updates.rst +++ /dev/null @@ -1,4 +0,0 @@ -FindwxWidgets-updates ---------------------- - -* The :module:`FindwxWidgets` module learned to support version requests. diff --git a/Help/release/dev/GNUInstallDirs-special-prefixes.rst b/Help/release/dev/GNUInstallDirs-special-prefixes.rst deleted file mode 100644 index 83c1352..0000000 --- a/Help/release/dev/GNUInstallDirs-special-prefixes.rst +++ /dev/null @@ -1,9 +0,0 @@ -GNUInstallDirs-special-prefixes -------------------------------- - -* The :module:`GNUInstallDirs` module learned special default values - for certain installation prefixes according to the `GNU Coding - Standards`_ and the `Filesystem Hierarchy Standard`_. - -.. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html -.. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html diff --git a/Help/release/dev/OUTPUT_DIRECTORY-genex.rst b/Help/release/dev/OUTPUT_DIRECTORY-genex.rst deleted file mode 100644 index 8b839c0..0000000 --- a/Help/release/dev/OUTPUT_DIRECTORY-genex.rst +++ /dev/null @@ -1,7 +0,0 @@ -OUTPUT_DIRECTORY-genex ----------------------- - -* The :prop_tgt:`ARCHIVE_OUTPUT_DIRECTORY`, - :prop_tgt:`LIBRARY_OUTPUT_DIRECTORY`, and - :prop_tgt:`RUNTIME_OUTPUT_DIRECTORY` target properties learned to - support :manual:`generator expressions <cmake-generator-expressions(7)>`. diff --git a/Help/release/dev/OUTPUT_NAME-genex.rst b/Help/release/dev/OUTPUT_NAME-genex.rst deleted file mode 100644 index 0a39820..0000000 --- a/Help/release/dev/OUTPUT_NAME-genex.rst +++ /dev/null @@ -1,5 +0,0 @@ -OUTPUT_NAME-genex ------------------ - -* The :prop_tgt:`OUTPUT_NAME` target property and its variants learned to - support :manual:`generator expressions <cmake-generator-expressions(7)>`. diff --git a/Help/release/dev/Threads-CXX.rst b/Help/release/dev/Threads-CXX.rst deleted file mode 100644 index 2e34a01..0000000 --- a/Help/release/dev/Threads-CXX.rst +++ /dev/null @@ -1,6 +0,0 @@ -Threads-CXX ------------- - -* The :module:`CheckFunctionExists`, :module:`CheckLibraryExists`, - :module:`CheckSymbolExists`, and :module:`FindThreads` modules learned to - work in environments where only CXX is enabled. diff --git a/Help/release/dev/add-apple-swift-language.rst b/Help/release/dev/add-apple-swift-language.rst deleted file mode 100644 index 60ce5d8..0000000 --- a/Help/release/dev/add-apple-swift-language.rst +++ /dev/null @@ -1,9 +0,0 @@ -add-apple-swift-language ------------------------- - -* CMake learned rudimentary support for the Apple Swift language. When using - the :generator:`Xcode` generator with Xcode 6.1 or higher, one may enable - the ``Swift`` language with the :command:`enable_language` command or the - :command:`project` command (this is an error with other generators or when - Xcode is too old). Then one may list ``.swift`` source files in targets - for compilation. diff --git a/Help/release/dev/add-link-search-static-properties-defaults.rst b/Help/release/dev/add-link-search-static-properties-defaults.rst deleted file mode 100644 index 98dda30..0000000 --- a/Help/release/dev/add-link-search-static-properties-defaults.rst +++ /dev/null @@ -1,9 +0,0 @@ -add-link-search-static-properties-defaults ------------------------------------------- - -* New :variable:`CMAKE_LINK_SEARCH_START_STATIC` and - :variable:`CMAKE_LINK_SEARCH_END_STATIC` variables were - introduced to initialize the - :prop_tgt:`LINK_SEARCH_START_STATIC` and - :prop_tgt:`LINK_SEARCH_END_STATIC` target properties, - respectively. diff --git a/Help/release/dev/auto_export_dll_symbols.rst b/Help/release/dev/auto_export_dll_symbols.rst deleted file mode 100644 index 9db2b5e..0000000 --- a/Help/release/dev/auto_export_dll_symbols.rst +++ /dev/null @@ -1,6 +0,0 @@ -auto_export_dll_symbols ------------------------ - -* On Windows with MS-compatible tools, CMake learned to optionally - generate a module definition (``.def``) file for ``SHARED`` libraries. - See the :prop_tgt:`WINDOWS_EXPORT_ALL_SYMBOLS` target property. diff --git a/Help/release/dev/compiler-launcher.rst b/Help/release/dev/compiler-launcher.rst deleted file mode 100644 index 3ba692d..0000000 --- a/Help/release/dev/compiler-launcher.rst +++ /dev/null @@ -1,8 +0,0 @@ -compiler-launcher ------------------ - -* The :ref:`Makefile Generators` and the :generator:`Ninja` generator - learned to add compiler launcher tools like distcc and ccache along with the - compiler for ``C`` and ``CXX`` languages. See the - :variable:`CMAKE_<LANG>_COMPILER_LAUNCHER` variable and - :prop_tgt:`<LANG>_COMPILER_LAUNCHER` target property for details. diff --git a/Help/release/dev/cpack-deb-checksum-on-symlinks.rts b/Help/release/dev/cpack-deb-checksum-on-symlinks.rts deleted file mode 100644 index 9bfeded..0000000 --- a/Help/release/dev/cpack-deb-checksum-on-symlinks.rts +++ /dev/null @@ -1,4 +0,0 @@ -cpack-deb-checksum-on-symlinks ------------------------------- - -* The :module:`CPackDeb` module now correctly excludes symlinks during package checksum calculation. diff --git a/Help/release/dev/cpack-deb-component-dependencies.rst b/Help/release/dev/cpack-deb-component-dependencies.rst deleted file mode 100644 index 2714222..0000000 --- a/Help/release/dev/cpack-deb-component-dependencies.rst +++ /dev/null @@ -1,12 +0,0 @@ -cpack-deb-component-dependencies --------------------------------- - -* The :module:`CPackDeb` module learned to set package dependencies - per component. See :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS`, - :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES`, - :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS`, - :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS`, - :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES`, - :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES`, - :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS` and - :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS`. diff --git a/Help/release/dev/cpack-deb-fakeroot-removal.rts b/Help/release/dev/cpack-deb-fakeroot-removal.rts deleted file mode 100644 index e0b97d1..0000000 --- a/Help/release/dev/cpack-deb-fakeroot-removal.rts +++ /dev/null @@ -1,4 +0,0 @@ -cpack-deb-fakeroot-removal --------------------------- - -* :module:`CPackDeb` no longer uses fakeroot and system tar program for packaging. diff --git a/Help/release/dev/cpack-nsis-bitmap.rst b/Help/release/dev/cpack-nsis-bitmap.rst new file mode 100644 index 0000000..c5ccfb5 --- /dev/null +++ b/Help/release/dev/cpack-nsis-bitmap.rst @@ -0,0 +1,6 @@ +cpack-nsis-bitmap +----------------- + +* The :module:`CPackNSIS` module learned new variables to add bitmaps to the + installer. See the :variable:`CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP` + and :variable:`CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP` variables. diff --git a/Help/release/dev/cpack-package-empty-dirs.rts b/Help/release/dev/cpack-package-empty-dirs.rts deleted file mode 100644 index 1f56e1a..0000000 --- a/Help/release/dev/cpack-package-empty-dirs.rts +++ /dev/null @@ -1,4 +0,0 @@ -cpack-package-empty-dirs ------------------------- - -* The :module:`CPack` module learned to package empty directories. diff --git a/Help/release/dev/ctest-custom-output-size.rst b/Help/release/dev/ctest-custom-output-size.rst deleted file mode 100644 index 8098b93..0000000 --- a/Help/release/dev/ctest-custom-output-size.rst +++ /dev/null @@ -1,7 +0,0 @@ -ctest-custom-output-size ------------------------- - -* :manual:`ctest(1)` learned options - ``--test-output-size-passed`` and ``--test-output-size-failed`` - to customize the limit on test output size submitted when - running as a :ref:`Dashboard Client`. diff --git a/Help/release/dev/ctest-test-load-option.rst b/Help/release/dev/ctest-test-load-option.rst deleted file mode 100644 index 069f49a..0000000 --- a/Help/release/dev/ctest-test-load-option.rst +++ /dev/null @@ -1,9 +0,0 @@ -ctest-test-load-option ----------------------- - -* CTest learned to optionally measure the CPU load during parallel - testing and avoid starting tests that may cause the load to exceed - a given threshold. See the :manual:`ctest(1)` command ``--test-load`` - option, the ``TestLoad`` setting of the :ref:`CTest Test Step`, - the :variable:`CTEST_TEST_LOAD` variable, and the ``TEST_LOAD`` - option of the :command:`ctest_test` command. diff --git a/Help/release/dev/doc-CMakeExpandImportedTargets-deprecated.rst b/Help/release/dev/doc-CMakeExpandImportedTargets-deprecated.rst deleted file mode 100644 index 3bdaebe..0000000 --- a/Help/release/dev/doc-CMakeExpandImportedTargets-deprecated.rst +++ /dev/null @@ -1,5 +0,0 @@ -doc-CMakeExpandImportedTargets-deprecated ------------------------------------------ - -* The :module:`CMakeExpandImportedTargets` module is now documented - as deprecated. See module documentation for an explanation. diff --git a/Help/release/dev/find_program-NAMES_PER_DIR.rst b/Help/release/dev/find_program-NAMES_PER_DIR.rst deleted file mode 100644 index 04cd170..0000000 --- a/Help/release/dev/find_program-NAMES_PER_DIR.rst +++ /dev/null @@ -1,6 +0,0 @@ -find_program-NAMES_PER_DIR --------------------------- - -* The :command:`find_program` command learned a ``NAMES_PER_DIR`` - option to consdier all given ``NAMES`` in each directory before - moving on to the next directory. diff --git a/Help/release/dev/genex-SHELL_PATH.rst b/Help/release/dev/genex-SHELL_PATH.rst deleted file mode 100644 index 86af720..0000000 --- a/Help/release/dev/genex-SHELL_PATH.rst +++ /dev/null @@ -1,6 +0,0 @@ -genex-SHELL_PATH ----------------- - -* A new ``$<SHELL_PATH:...>`` - :manual:`generator expression <cmake-generator-expressions(7)>` - has been added. diff --git a/Help/release/dev/get-filename-component-base-dir.rst b/Help/release/dev/get-filename-component-base-dir.rst deleted file mode 100644 index c0df759..0000000 --- a/Help/release/dev/get-filename-component-base-dir.rst +++ /dev/null @@ -1,6 +0,0 @@ -get-filename-component-base-dir -------------------------------- - -* The :command:`get_filename_component` command learned a new ``BASE_DIR`` - subcommand. This is used to specify a base directory when calculating an - absolute path from a relative path. diff --git a/Help/release/dev/if-TEST.rst b/Help/release/dev/if-TEST.rst deleted file mode 100644 index 05bf71c..0000000 --- a/Help/release/dev/if-TEST.rst +++ /dev/null @@ -1,5 +0,0 @@ -if-TEST -------- - -* Add a new TEST operator to if() that evaluates to true - if a given test name has been defined. diff --git a/Help/release/dev/install-directory-dest-genex.rst b/Help/release/dev/install-directory-dest-genex.rst deleted file mode 100644 index 2b83bbd..0000000 --- a/Help/release/dev/install-directory-dest-genex.rst +++ /dev/null @@ -1,5 +0,0 @@ -install-directory-dest-genex ----------------------------- - -* The :command:`install(DIRECTORY)` command ``DESTINATION`` option learned to - support :manual:`generator expressions <cmake-generator-expressions(7)>`. diff --git a/Help/release/dev/install-files-dest-genex.rst b/Help/release/dev/install-files-dest-genex.rst deleted file mode 100644 index b7aa8b3..0000000 --- a/Help/release/dev/install-files-dest-genex.rst +++ /dev/null @@ -1,5 +0,0 @@ -install-files-dest-genex ------------------------- - -* The :command:`install(FILES)` command ``DESTINATION`` option learned to - support :manual:`generator expressions <cmake-generator-expressions(7)>`. diff --git a/Help/release/dev/java-updates.rst b/Help/release/dev/java-updates.rst deleted file mode 100644 index 8fd4ed6..0000000 --- a/Help/release/dev/java-updates.rst +++ /dev/null @@ -1,16 +0,0 @@ -java-updates ------------- - -* The :module:`FindJava` module learned to optionally find - the ``idlj`` and ``jarsigner`` tools. - -* The :module:`UseJava` module ``add_jar`` function learned - to support response files (e.g. ``@srcs.txt``) for source - specification. - -* The :module:`UseJava` module ``install_jar`` function learned - new ``DESTINATION`` and ``COMPONENT`` options to specify - the corresponding :command:`install` command options. - -* The :module:`UseJava` module gained a new ``create_javah`` - function to create C headers from Java classes. diff --git a/Help/release/dev/makefile-target-messages.rst b/Help/release/dev/makefile-target-messages.rst deleted file mode 100644 index 3d2cd9b..0000000 --- a/Help/release/dev/makefile-target-messages.rst +++ /dev/null @@ -1,6 +0,0 @@ -makefile-target-messages ------------------------- - -* A :prop_gbl:`TARGET_MESSAGES` global property was added to tell the - :ref:`Makefile Generators` whether to generate commands to print output - after each target is completed. diff --git a/Help/release/dev/mingw-compile-features-C.rst b/Help/release/dev/mingw-compile-features-C.rst deleted file mode 100644 index b3f99f1..0000000 --- a/Help/release/dev/mingw-compile-features-C.rst +++ /dev/null @@ -1,5 +0,0 @@ -mingw-compile-features-C ------------------------- - -* The :manual:`Compile Features <cmake-compile-features(7)>` functionality - is now aware of features supported by GNU C compilers on Windows. diff --git a/Help/release/dev/modules-no-soname.rst b/Help/release/dev/modules-no-soname.rst deleted file mode 100644 index 8fe74f8..0000000 --- a/Help/release/dev/modules-no-soname.rst +++ /dev/null @@ -1,7 +0,0 @@ -modules-no-soname ------------------ - -* The ``SONAME`` field is no longer set for ``MODULE`` libraries - created with the :command:`add_library` command. ``MODULE`` - libraries are meant for explicit dynamic loading at runtime. - They cannot be linked so ``SONAME`` is not useful. diff --git a/Help/release/dev/ms-manifest-files.rst b/Help/release/dev/ms-manifest-files.rst deleted file mode 100644 index 94fbe83..0000000 --- a/Help/release/dev/ms-manifest-files.rst +++ /dev/null @@ -1,7 +0,0 @@ -ms-manifest-files ------------------ - -* CMake learned to honor ``*.manifest`` source files with MSVC tools. - Manifest files named as sources of ``.exe`` and ``.dll`` targets - will be merged with linker-generated manifests and embedded in the - binary. diff --git a/Help/release/dev/pkg-config-variable-function.rst b/Help/release/dev/pkg-config-variable-function.rst deleted file mode 100644 index e181d13..0000000 --- a/Help/release/dev/pkg-config-variable-function.rst +++ /dev/null @@ -1,6 +0,0 @@ -pkg-config-variable-function ----------------------------- - -* The :module:`FindPkgConfig` learned a new :command:`pkg_get_variable` - command which may be used to query for arbitrary variables from a package - (such as for related tools or data and plugin install paths). diff --git a/Help/release/dev/remove-CMAKE_USE_RELATIVE_PATHS.rst b/Help/release/dev/remove-CMAKE_USE_RELATIVE_PATHS.rst deleted file mode 100644 index dd52ace..0000000 --- a/Help/release/dev/remove-CMAKE_USE_RELATIVE_PATHS.rst +++ /dev/null @@ -1,5 +0,0 @@ -remove-CMAKE_USE_RELATIVE_PATHS -------------------------------- - -* The :variable:`CMAKE_USE_RELATIVE_PATHS` variable no longer has any - effect. Previously it was partially implemented and unreliable. diff --git a/Help/release/dev/restrict-shlib-link-flags-to-enable-exports.rst b/Help/release/dev/restrict-shlib-link-flags-to-enable-exports.rst deleted file mode 100644 index f8ce044..0000000 --- a/Help/release/dev/restrict-shlib-link-flags-to-enable-exports.rst +++ /dev/null @@ -1,6 +0,0 @@ -restrict-shlib-link-flags-to-enable-exports -------------------------------------------- - -* CMake no longer links executables with flags to export symbols - unless the :prop_tgt:`ENABLE_EXPORTS` target property is set. - See policy :policy:`CMP0065`. diff --git a/Help/release/dev/string-append.rst b/Help/release/dev/string-append.rst deleted file mode 100644 index 190b51e..0000000 --- a/Help/release/dev/string-append.rst +++ /dev/null @@ -1,4 +0,0 @@ -string-append -------------- - -* The :command:`string` command learned a new ``APPEND`` subcommand. diff --git a/Help/release/dev/target-directory-properties.rst b/Help/release/dev/target-directory-properties.rst deleted file mode 100644 index 5ab2938..0000000 --- a/Help/release/dev/target-directory-properties.rst +++ /dev/null @@ -1,5 +0,0 @@ -target-directory-properties ---------------------------- - -* The :prop_tgt:`SOURCE_DIR` and :prop_tgt:`BINARY_DIR` target properties - were introduced to allow project code to query where a target is defined. diff --git a/Help/release/dev/trace-expand.rst b/Help/release/dev/trace-expand.rst deleted file mode 100644 index 383326e..0000000 --- a/Help/release/dev/trace-expand.rst +++ /dev/null @@ -1,5 +0,0 @@ -trace-expand ------------- - -* Add ``--trace-expand`` argument to CMake. Acts like ``--trace``, but expands - variable references in the output. diff --git a/Help/release/dev/vs-nsight-tegra-attributes.rst b/Help/release/dev/vs-nsight-tegra-attributes.rst deleted file mode 100644 index 7ebea33..0000000 --- a/Help/release/dev/vs-nsight-tegra-attributes.rst +++ /dev/null @@ -1,21 +0,0 @@ -vs-nsight-tegra-attributes --------------------------- - -* :ref:`Visual Studio Generators` learned to support additonal - target properties to customize projects for NVIDIA Nsight - Tegra Visual Studio Edition: - - * :prop_tgt:`ANDROID_ANT_ADDITIONAL_OPTIONS` - * :prop_tgt:`ANDROID_ARCH` - * :prop_tgt:`ANDROID_ASSETS_DIRECTORIES` - * :prop_tgt:`ANDROID_JAR_DEPENDENCIES` - * :prop_tgt:`ANDROID_JAR_DIRECTORIES` - * :prop_tgt:`ANDROID_JAVA_SOURCE_DIR` - * :prop_tgt:`ANDROID_NATIVE_LIB_DEPENDENCIES` - * :prop_tgt:`ANDROID_NATIVE_LIB_DIRECTORIES` - * :prop_tgt:`ANDROID_PROCESS_MAX` - * :prop_tgt:`ANDROID_PROGUARD` - * :prop_tgt:`ANDROID_PROGUARD_CONFIG_PATH` - * :prop_tgt:`ANDROID_SECURE_PROPS_PATH` - * :prop_tgt:`ANDROID_SKIP_ANT_STEP` - * :prop_tgt:`ANDROID_STL_TYPE` diff --git a/Help/release/index.rst b/Help/release/index.rst index b558e9d..752acbd 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -13,6 +13,7 @@ Releases .. toctree:: :maxdepth: 1 + 3.4 <3.4> 3.3 <3.3> 3.2 <3.2> 3.1 <3.1> diff --git a/Help/variable/CMAKE_BINARY_DIR.rst b/Help/variable/CMAKE_BINARY_DIR.rst index f8dd8ab..3b323b7 100644 --- a/Help/variable/CMAKE_BINARY_DIR.rst +++ b/Help/variable/CMAKE_BINARY_DIR.rst @@ -6,3 +6,8 @@ The path to the top level of the build tree. This is the full path to the top level of the current CMake build tree. For an in-source build, this would be the same as :variable:`CMAKE_SOURCE_DIR`. + +When run in -P script mode, CMake sets the variables +:variable:`CMAKE_BINARY_DIR`, :variable:`CMAKE_SOURCE_DIR`, +:variable:`CMAKE_CURRENT_BINARY_DIR` and +:variable:`CMAKE_CURRENT_SOURCE_DIR` to the current working directory. diff --git a/Help/variable/CMAKE_CURRENT_BINARY_DIR.rst b/Help/variable/CMAKE_CURRENT_BINARY_DIR.rst index cc3b639..40496b5 100644 --- a/Help/variable/CMAKE_CURRENT_BINARY_DIR.rst +++ b/Help/variable/CMAKE_CURRENT_BINARY_DIR.rst @@ -8,3 +8,8 @@ processed by cmake. Each directory added by :command:`add_subdirectory` will create a binary directory in the build tree, and as it is being processed this variable will be set. For in-source builds this is the current source directory being processed. + +When run in -P script mode, CMake sets the variables +:variable:`CMAKE_BINARY_DIR`, :variable:`CMAKE_SOURCE_DIR`, +:variable:`CMAKE_CURRENT_BINARY_DIR` and +:variable:`CMAKE_CURRENT_SOURCE_DIR` to the current working directory. diff --git a/Help/variable/CMAKE_CURRENT_SOURCE_DIR.rst b/Help/variable/CMAKE_CURRENT_SOURCE_DIR.rst index db063a4..c1b755a 100644 --- a/Help/variable/CMAKE_CURRENT_SOURCE_DIR.rst +++ b/Help/variable/CMAKE_CURRENT_SOURCE_DIR.rst @@ -5,3 +5,8 @@ The path to the source directory currently being processed. This the full path to the source directory that is currently being processed by cmake. + +When run in -P script mode, CMake sets the variables +:variable:`CMAKE_BINARY_DIR`, :variable:`CMAKE_SOURCE_DIR`, +:variable:`CMAKE_CURRENT_BINARY_DIR` and +:variable:`CMAKE_CURRENT_SOURCE_DIR` to the current working directory. diff --git a/Help/variable/CMAKE_SOURCE_DIR.rst b/Help/variable/CMAKE_SOURCE_DIR.rst index 3df0226..416fbe1 100644 --- a/Help/variable/CMAKE_SOURCE_DIR.rst +++ b/Help/variable/CMAKE_SOURCE_DIR.rst @@ -6,3 +6,8 @@ The path to the top level of the source tree. This is the full path to the top level of the current CMake source tree. For an in-source build, this would be the same as :variable:`CMAKE_BINARY_DIR`. + +When run in -P script mode, CMake sets the variables +:variable:`CMAKE_BINARY_DIR`, :variable:`CMAKE_SOURCE_DIR`, +:variable:`CMAKE_CURRENT_BINARY_DIR` and +:variable:`CMAKE_CURRENT_SOURCE_DIR` to the current working directory. diff --git a/Help/variable/CMAKE_SYSTEM_NAME.rst b/Help/variable/CMAKE_SYSTEM_NAME.rst index 0466da4..c3a42e5 100644 --- a/Help/variable/CMAKE_SYSTEM_NAME.rst +++ b/Help/variable/CMAKE_SYSTEM_NAME.rst @@ -1,8 +1,20 @@ CMAKE_SYSTEM_NAME ----------------- -Name of the operating system CMake is building for. +The name of the operating system for which CMake is to build. +See the :variable:`CMAKE_SYSTEM_VERSION` variable for the OS version. -This is the name of the operating system on which CMake is targeting. This -variable is the same as :variable:`CMAKE_HOST_SYSTEM_NAME` if you build for the -host system instead of the target system when cross compiling. +System Name for Host Builds +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``CMAKE_SYSTEM_NAME`` is by default set to the same value as the +:variable:`CMAKE_HOST_SYSTEM_NAME` variable so that the build +targets the host system. + +System Name for Cross Compiling +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``CMAKE_SYSTEM_NAME`` may be set explicitly when first configuring a new build +tree in order to enable :ref:`cross compiling <Cross Compiling Toolchain>`. +In this case the :variable:`CMAKE_SYSTEM_VERSION` variable must also be +set explicitly. diff --git a/Help/variable/CMAKE_SYSTEM_VERSION.rst b/Help/variable/CMAKE_SYSTEM_VERSION.rst index 3b3cdc5..aba8ca3 100644 --- a/Help/variable/CMAKE_SYSTEM_VERSION.rst +++ b/Help/variable/CMAKE_SYSTEM_VERSION.rst @@ -1,8 +1,28 @@ CMAKE_SYSTEM_VERSION -------------------- -The operating system version CMake is building for. +The version of the operating system for which CMake is to build. +See the :variable:`CMAKE_SYSTEM_NAME` variable for the OS name. -This variable is the same as :variable:`CMAKE_HOST_SYSTEM_VERSION` if -you build for the host system instead of the target system when -cross compiling. +System Version for Host Builds +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When the :variable:`CMAKE_SYSTEM_NAME` variable takes its default value +then ``CMAKE_SYSTEM_VERSION`` is by default set to the same value as the +:variable:`CMAKE_HOST_SYSTEM_VERSION` variable so that the build targets +the host system version. + +In the case of a host build then ``CMAKE_SYSTEM_VERSION`` may be set +explicitly when first configuring a new build tree in order to enable +targeting the build for a different version of the host operating system +than is actually running on the host. This is allowed and not considered +cross compiling so long as the binaries built for the specified OS version +can still run on the host. + +System Version for Cross Compiling +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When the :variable:`CMAKE_SYSTEM_NAME` variable is set explicitly to +enable :ref:`cross compiling <Cross Compiling Toolchain>` then the +value of ``CMAKE_SYSTEM_VERSION`` must also be set explicitly to specify +the target system version. diff --git a/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst b/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst new file mode 100644 index 0000000..6392849 --- /dev/null +++ b/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst @@ -0,0 +1,11 @@ +CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION +---------------------------------------- + +Visual Studio Windows Target Platform Version. + +When targeting Windows 10 and above Visual Studio 2015 and above support +specification of a target Windows version to select a corresponding SDK. +The :variable:`CMAKE_SYSTEM_VERSION` variable may be set to specify a +version. Otherwise CMake computes a default version based on the Windows +SDK versions available. The chosen Windows target version number is provided +in ``CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION``. diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index c72e338..a1bfc70 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -2,6 +2,7 @@ set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@") set(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@") set(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@") set(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@") +set(CMAKE_C_COMPILER_LINKS_STATICALLY "@CMAKE_C_COMPILER_LINKS_STATICALLY@") set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "@CMAKE_C_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@") set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@") diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index d2417aa..0d102a1 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -75,6 +75,10 @@ if(CMAKE_C_SIZEOF_DATA_PTR) unset(CMAKE_C_ABI_FILES) endif() +if(CMAKE_C_COMPILER_LINKS_STATICALLY) + set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) +endif() + # This should be included before the _INIT variables are # used to initialize the cache. Since the rule variables # have if blocks on them, users can still define them here. diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 52e44f6..4218a6d 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -2,6 +2,7 @@ set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@") set(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@") set(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@") set(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@") +set(CMAKE_CXX_COMPILER_LINKS_STATICALLY "@CMAKE_CXX_COMPILER_LINKS_STATICALLY@") set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_CXX_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@") set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@") diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 091627b..dad7969 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -74,6 +74,10 @@ if(CMAKE_CXX_SIZEOF_DATA_PTR) unset(CMAKE_CXX_ABI_FILES) endif() +if(CMAKE_CXX_COMPILER_LINKS_STATICALLY) + set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) +endif() + # This should be included before the _INIT variables are # used to initialize the cache. Since the rule variables # have if blocks on them, users can still define them here. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index df6daf3..2e74100 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -106,6 +106,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX}" PARENT_SCOPE) + set(CMAKE_${lang}_COMPILER_LINKS_STATICALLY "${CMAKE_${lang}_COMPILER_LINKS_STATICALLY}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) @@ -209,6 +210,9 @@ Id flags: ${testflags} else() set(id_system_version "") endif() + if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION) + set(id_WindowsTargetPlatformVersion "<WindowsTargetPlatformVersion>${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}</WindowsTargetPlatformVersion>") + endif() if(id_platform STREQUAL ARM) set(id_WindowsSDKDesktopARMSupport "<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>") else() @@ -529,6 +533,13 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) endif() endif() + if(UNIX) + execute_process(COMMAND file "${file}" OUTPUT_VARIABLE out ERROR_VARIABLE out) + if(out MATCHES "statically linked") + set(CMAKE_${lang}_COMPILER_LINKS_STATICALLY 1 PARENT_SCOPE) + endif() + endif() + # Check if a valid compiler and platform were found. if(COMPILER_ID AND NOT COMPILER_ID_TWICE) set(CMAKE_${lang}_COMPILER_ID "${COMPILER_ID}") diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index fa14641..d9f7579 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -123,7 +123,9 @@ elseif(CMAKE_VS_WINCE_VERSION) set(PRESET_CMAKE_SYSTEM_NAME TRUE) else() set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}") - set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}") + if(NOT DEFINED CMAKE_SYSTEM_VERSION) + set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}") + endif() set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") set(CMAKE_CROSSCOMPILING FALSE) set(PRESET_CMAKE_SYSTEM_NAME FALSE) diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 14fdd60..6b984e5 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -2,6 +2,7 @@ set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@") set(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@") set(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@") set(CMAKE_Fortran_COMPILER_VERSION "@CMAKE_Fortran_COMPILER_VERSION@") +set(CMAKE_Fortran_COMPILER_LINKS_STATICALLY "@CMAKE_Fortran_COMPILER_LINKS_STATICALLY@") set(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@") set(CMAKE_Fortran_SIMULATE_ID "@CMAKE_Fortran_SIMULATE_ID@") set(CMAKE_Fortran_SIMULATE_VERSION "@CMAKE_Fortran_SIMULATE_VERSION@") diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 79393d3..aa48df7 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -51,6 +51,10 @@ if(CMAKE_Fortran_SIZEOF_DATA_PTR) unset(CMAKE_Fortran_ABI_FILES) endif() +if(CMAKE_Fortran_COMPILER_LINKS_STATICALLY) + set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) +endif() + # This should be included before the _INIT variables are # used to initialize the cache. Since the rule variables # have if blocks on them, users can still define them here. diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake index c6b3d19..db5984a 100644 --- a/Modules/CPackNSIS.cmake +++ b/Modules/CPackNSIS.cmake @@ -30,6 +30,14 @@ # # undocumented. # +# .. variable:: CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP +# +# The filename of a bitmap to use as the NSIS MUI_WELCOMEFINISHPAGE_BITMAP. +# +# .. variable:: CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP +# +# The filename of a bitmap to use as the NSIS MUI_UNWELCOMEFINISHPAGE_BITMAP. +# # .. variable:: CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS # # Extra NSIS commands that will be added to the beginning of the install diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index 6e80fb5..c2b1723 100644 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -93,7 +93,7 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR) message(STATUS "Performing Test ${VAR} - Success") endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" + "Performing C SOURCE FILE Test ${VAR} succeeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") else() diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake index 0ce423c..5afeab6 100644 --- a/Modules/CheckCSourceRuns.cmake +++ b/Modules/CheckCSourceRuns.cmake @@ -81,7 +81,7 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR) message(STATUS "Performing Test ${VAR} - Success") endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" + "Performing C SOURCE FILE Test ${VAR} succeeded with the following output:\n" "${OUTPUT}\n" "Return value: ${${VAR}}\n" "Source file was:\n${SOURCE}\n") diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index 6d52ec6..f8736e2 100644 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -94,7 +94,7 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) message(STATUS "Performing Test ${VAR} - Success") endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" + "Performing C++ SOURCE FILE Test ${VAR} succeeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") else() diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index 3c06d75..84b661d 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -82,7 +82,7 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR) message(STATUS "Performing Test ${VAR} - Success") endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" + "Performing C++ SOURCE FILE Test ${VAR} succeeded with the following output:\n" "${OUTPUT}\n" "Return value: ${${VAR}}\n" "Source file was:\n${SOURCE}\n") diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake index f90d05b..0bdcffa 100644 --- a/Modules/CheckFortranSourceCompiles.cmake +++ b/Modules/CheckFortranSourceCompiles.cmake @@ -94,7 +94,7 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR) message(STATUS "Performing Test ${VAR} - Success") endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing Fortran SOURCE FILE Test ${VAR} succeded with the following output:\n" + "Performing Fortran SOURCE FILE Test ${VAR} succeeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") else() diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in index a17d03d..2870a11 100644 --- a/Modules/CompilerId/VS-10.vcxproj.in +++ b/Modules/CompilerId/VS-10.vcxproj.in @@ -12,6 +12,7 @@ <Keyword>Win32Proj</Keyword> @id_system@ @id_system_version@ + @id_WindowsTargetPlatformVersion@ @id_WindowsSDKDesktopARMSupport@ </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 72bb8eb..ab4ef3e 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -202,6 +202,43 @@ function(_GTK2_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr) endif() endfunction() + +#============================================================= +# _GTK2_SIGCXX_GET_VERSION +# Internal function to parse the version number in +# sigc++config.h +# _OUT_major = Major version number +# _OUT_minor = Minor version number +# _OUT_micro = Micro version number +# _sigcxxversion_hdr = Header file to parse +#============================================================= + +function(_GTK2_SIGCXX_GET_VERSION _OUT_major _OUT_minor _OUT_micro _sigcxxversion_hdr) + file(STRINGS ${_sigcxxversion_hdr} _contents REGEX "#define SIGCXX_M[A-Z]+_VERSION[ \t]+") + if(_contents) + string(REGEX REPLACE ".*#define SIGCXX_MAJOR_VERSION[ \t]+([0-9]+).*" "\\1" ${_OUT_major} "${_contents}") + string(REGEX REPLACE ".*#define SIGCXX_MINOR_VERSION[ \t]+([0-9]+).*" "\\1" ${_OUT_minor} "${_contents}") + string(REGEX REPLACE ".*#define SIGCXX_MICRO_VERSION[ \t]+([0-9]+).*" "\\1" ${_OUT_micro} "${_contents}") + + if(NOT ${_OUT_major} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for SIGCXX_MAJOR_VERSION!") + endif() + if(NOT ${_OUT_minor} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for SIGCXX_MINOR_VERSION!") + endif() + if(NOT ${_OUT_micro} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for SIGCXX_MICRO_VERSION!") + endif() + + set(${_OUT_major} ${${_OUT_major}} PARENT_SCOPE) + set(${_OUT_minor} ${${_OUT_minor}} PARENT_SCOPE) + set(${_OUT_micro} ${${_OUT_micro}} PARENT_SCOPE) + else() + message(FATAL_ERROR "Include file ${_gtkversion_hdr} does not exist") + endif() +endfunction() + + #============================================================= # _GTK2_FIND_INCLUDE_DIR # Internal function to find the GTK include directories @@ -734,6 +771,27 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(SIGC++CONFIG sigc++config.h) _GTK2_FIND_LIBRARY (SIGC++ sigc true true) _GTK2_ADD_TARGET (SIGC++) + # Since sigc++ 2.5.1 c++11 support is required + if(GTK2_SIGC++CONFIG_INCLUDE_DIR) + _GTK2_SIGCXX_GET_VERSION(GTK2_SIGC++_VERSION_MAJOR + GTK2_SIGC++_VERSION_MINOR + GTK2_SIGC++_VERSION_MICRO + ${GTK2_SIGC++CONFIG_INCLUDE_DIR}/sigc++config.h) + if(NOT ${GTK2_SIGC++_VERSION_MAJOR}.${GTK2_SIGC++_VERSION_MINOR}.${GTK2_SIGC++_VERSION_MICRO} VERSION_LESS 2.5.1) + # These are the features needed by clients in order to include the + # project headers: + set_property(TARGET GTK2::sigc++ + PROPERTY INTERFACE_COMPILE_FEATURES cxx_alias_templates + cxx_auto_type + cxx_decltype + cxx_deleted_functions + cxx_noexcept + cxx_nullptr + cxx_right_angle_brackets + cxx_rvalue_references + cxx_variadic_templates) + endif() + endif() _GTK2_FIND_INCLUDE_DIR(GLIBMM glibmm.h) _GTK2_FIND_INCLUDE_DIR(GLIBMMCONFIG glibmmconfig.h) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index a47a69c..7a36719 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -229,6 +229,7 @@ if(NOT MATLAB_ADDITIONAL_VERSIONS) endif() set(MATLAB_VERSIONS_MAPPING + "R2015b=8.6" "R2015a=8.5" "R2014b=8.4" "R2014a=8.3" diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index d75e8ab..8b4b988 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -37,6 +37,7 @@ # # Set ``OPENSSL_ROOT_DIR`` to the root directory of an OpenSSL installation. # Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries. +# Set ``OPENSSL_MSVC_STATIC_RT`` set ``TRUE`` to choose the MT version of the lib. #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -113,7 +114,7 @@ if(WIN32 AND NOT CYGWIN) # /MD and /MDd are the standard values - if someone wants to use # others, the libnames have to change here too # use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b - # TODO: handle /MT and static lib + # enable OPENSSL_MSVC_STATIC_RT to get the libs build /MT (Multithreaded no-DLL) # In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix: # * MD for dynamic-release # * MDd for dynamic-debug @@ -126,6 +127,12 @@ if(WIN32 AND NOT CYGWIN) # ssleay32MD.lib is identical to ../ssleay32.lib # enable OPENSSL_USE_STATIC_LIBS to use the static libs located in lib/VC/static + if (OPENSSL_MSVC_STATIC_RT) + set(_OPENSSL_MSVC_RT_MODE "MT") + else () + set(_OPENSSL_MSVC_RT_MODE "MD") + endif () + if(OPENSSL_USE_STATIC_LIBS) set(_OPENSSL_PATH_SUFFIXES "lib" @@ -142,7 +149,7 @@ if(WIN32 AND NOT CYGWIN) find_library(LIB_EAY_DEBUG NAMES - libeay32MDd + libeay32${_OPENSSL_MSVC_RT_MODE}d libeay32d ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES @@ -151,7 +158,7 @@ if(WIN32 AND NOT CYGWIN) find_library(LIB_EAY_RELEASE NAMES - libeay32MD + libeay32${_OPENSSL_MSVC_RT_MODE} libeay32 ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES @@ -160,7 +167,7 @@ if(WIN32 AND NOT CYGWIN) find_library(SSL_EAY_DEBUG NAMES - ssleay32MDd + ssleay32${_OPENSSL_MSVC_RT_MODE}d ssleay32d ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES @@ -169,7 +176,7 @@ if(WIN32 AND NOT CYGWIN) find_library(SSL_EAY_RELEASE NAMES - ssleay32MD + ssleay32${_OPENSSL_MSVC_RT_MODE} ssleay32 ssl ${_OPENSSL_ROOT_HINTS_AND_PATHS} @@ -193,12 +200,8 @@ if(WIN32 AND NOT CYGWIN) set(OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} ) elseif(MINGW) # same player, for MinGW - set(LIB_EAY_NAMES libeay32) - set(SSL_EAY_NAMES ssleay32) - if(CMAKE_CROSSCOMPILING) - list(APPEND LIB_EAY_NAMES crypto) - list(APPEND SSL_EAY_NAMES ssl) - endif() + set(LIB_EAY_NAMES crypto libeay32) + set(SSL_EAY_NAMES ssl ssleay32) find_library(LIB_EAY NAMES ${LIB_EAY_NAMES} @@ -318,7 +321,7 @@ endfunction() if (OPENSSL_INCLUDE_DIR) if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h") file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str - REGEX "^# *define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") + REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") # The version number is encoded as 0xMNNFFPPS: major minor fix patch status # The status gives if this is a developer or prerelease and is ignored here. diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 76310af..1ef3d28 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -542,6 +542,8 @@ FunctionEnd ; Define some macro setting for the gui @CPACK_NSIS_INSTALLER_MUI_ICON_CODE@ @CPACK_NSIS_INSTALLER_ICON_CODE@ +@CPACK_NSIS_INSTALLER_MUI_WELCOMEFINISH_CODE@ +@CPACK_NSIS_INSTALLER_MUI_UNWELCOMEFINISH_CODE@ @CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@ @CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@ diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 8594596..b421b0d 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -179,7 +179,9 @@ elseif(WINDOWS_PHONE OR WINDOWS_STORE) set(_PLATFORM_DEFINES "/DWIN32") set(_FLAGS_C " /DUNICODE /D_UNICODE") set(_FLAGS_CXX " /DUNICODE /D_UNICODE /GR /EHsc") - if(WINDOWS_PHONE) + if(WINDOWS_STORE AND MSVC_VERSION GREATER 1899) + set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsApp.lib") + elseif(WINDOWS_PHONE) set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib") elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM") set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index eb53118..8095229 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) -set(CMake_VERSION_MINOR 3) -set(CMake_VERSION_PATCH 20150929) +set(CMake_VERSION_MINOR 4) +set(CMake_VERSION_PATCH 20151012) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 43d34ee..4eb23c1 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -24,7 +24,6 @@ #include <cmsys/RegularExpression.hxx> #include <cmGlobalGenerator.h> -#include <cmLocalGenerator.h> #include <cmSystemTools.h> #include <cmMakefile.h> #include <cmGeneratedFileStream.h> diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 70de757..db985db 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -14,7 +14,6 @@ #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmGeneratedFileStream.h" diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx index 6605f16..1f905c0 100644 --- a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx +++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx @@ -14,7 +14,6 @@ #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmGeneratedFileStream.h" diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx index f1e8539..f5cb53c 100644 --- a/Source/CPack/cmCPackCygwinSourceGenerator.cxx +++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx @@ -14,7 +14,6 @@ #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmGeneratedFileStream.h" diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index def9fc7..2f69c25 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -16,7 +16,6 @@ #include "cmCPackLog.h" #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmGeneratedFileStream.h" #include "cmCPackComponentGroup.h" #include "cmXMLSafe.h" @@ -723,8 +722,6 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cmGlobalGenerator gg(&cm); cmsys::auto_ptr<cmMakefile> mf( new cmMakefile(&gg, cm.GetCurrentSnapshot())); - cmsys::auto_ptr<cmLocalGenerator> lg( - gg.CreateLocalGenerator(mf.get())); std::string realInstallDirectory = tempInstallDirectory; if ( !installSubDirectory.empty() && installSubDirectory != "/" ) { diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 6cdda28..5ba639f 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -13,7 +13,6 @@ #include "cmCPackNSISGenerator.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmGeneratedFileStream.h" @@ -158,6 +157,28 @@ int cmCPackNSISGenerator::PackageFiles() installerIconCode.c_str()); } + if (this->IsSet("CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP")) + { + std::string installerBitmapCode = + "!define MUI_WELCOMEFINISHPAGE_BITMAP \""; + installerBitmapCode += + this->GetOption("CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP"); + installerBitmapCode += "\"\n"; + this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_WELCOMEFINISH_CODE", + installerBitmapCode.c_str()); + } + + if (this->IsSet("CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP")) + { + std::string installerBitmapCode = + "!define MUI_UNWELCOMEFINISHPAGE_BITMAP \""; + installerBitmapCode += + this->GetOption("CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP"); + installerBitmapCode += "\"\n"; + this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_UNWELCOMEFINISH_CODE", + installerBitmapCode.c_str()); + } + if(this->IsSet("CPACK_NSIS_MUI_FINISHPAGE_RUN")) { std::string installerRunCode = "!define MUI_FINISHPAGE_RUN \"$INSTDIR\\"; diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index d533af8..8940f54 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -13,7 +13,6 @@ #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmGeneratedFileStream.h" diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 880663f..8fdc036 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -13,7 +13,6 @@ #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmGeneratedFileStream.h" diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index 109dcb7..68b893f 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -14,7 +14,6 @@ #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmCPackLog.h" diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index cb9cbc4..f6447ec 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -18,7 +18,6 @@ #include "cmCPackGenerator.h" #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmCPackLog.h" @@ -204,8 +203,6 @@ int main (int argc, char const* const* argv) cmGlobalGenerator cmgg(&cminst); cmsys::auto_ptr<cmMakefile> globalMF( new cmMakefile(&cmgg, cminst.GetCurrentSnapshot())); - cmsys::auto_ptr<cmLocalGenerator> cmlg( - cmgg.CreateLocalGenerator(globalMF.get())); #if defined(__CYGWIN__) globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); #endif diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 6dbb245..0d74f48 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -15,7 +15,6 @@ #include "cmCTest.h" #include "cmake.h" #include "cmMakefile.h" -#include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmGeneratedFileStream.h" #include "cmXMLWriter.h" diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index fb0cce6..ca5d05a 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -728,7 +728,6 @@ int cmCTestLaunch::Main(int argc, const char* const argv[]) //---------------------------------------------------------------------------- #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmake.h" #include <cmsys/auto_ptr.hxx> @@ -739,8 +738,6 @@ void cmCTestLaunch::LoadConfig() cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); - cmsys::auto_ptr<cmLocalGenerator> lg( - gg.CreateLocalGenerator(mf.get())); std::string fname = this->LogDir; fname += "CTestLaunchConfig.cmake"; if(cmSystemTools::FileExists(fname.c_str()) && diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index c1ba279..b9016af 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -16,7 +16,6 @@ #include "cmake.h" #include "cmFunctionBlocker.h" #include "cmMakefile.h" -#include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmGeneratedFileStream.h" @@ -86,7 +85,6 @@ cmCTestScriptHandler::cmCTestScriptHandler() this->EmptyBinDir = false; this->EmptyBinDirOnce = false; this->Makefile = 0; - this->LocalGenerator = 0; this->CMake = 0; this->GlobalGenerator = 0; @@ -128,9 +126,6 @@ void cmCTestScriptHandler::Initialize() delete this->Makefile; this->Makefile = 0; - delete this->LocalGenerator; - this->LocalGenerator = 0; - delete this->GlobalGenerator; this->GlobalGenerator = 0; @@ -141,7 +136,6 @@ void cmCTestScriptHandler::Initialize() cmCTestScriptHandler::~cmCTestScriptHandler() { delete this->Makefile; - delete this->LocalGenerator; delete this->GlobalGenerator; delete this->CMake; } @@ -179,15 +173,14 @@ int cmCTestScriptHandler::ProcessHandler() void cmCTestScriptHandler::UpdateElapsedTime() { - if (this->LocalGenerator) + if (this->Makefile) { // set the current elapsed time char timeString[20]; int itime = static_cast<unsigned int>(cmSystemTools::GetTime() - this->ScriptStartTime); sprintf(timeString,"%i",itime); - this->LocalGenerator->GetMakefile()->AddDefinition("CTEST_ELAPSED_TIME", - timeString); + this->Makefile->AddDefinition("CTEST_ELAPSED_TIME", timeString); } } @@ -316,7 +309,6 @@ void cmCTestScriptHandler::CreateCMake() { delete this->CMake; delete this->GlobalGenerator; - delete this->LocalGenerator; delete this->Makefile; } this->CMake = new cmake; @@ -326,18 +318,13 @@ void cmCTestScriptHandler::CreateCMake() this->GlobalGenerator = new cmGlobalGenerator(this->CMake); cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot(); + std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); + snapshot.GetDirectory().SetCurrentSource(cwd); + snapshot.GetDirectory().SetCurrentBinary(cwd); this->Makefile = new cmMakefile(this->GlobalGenerator, snapshot); - this->LocalGenerator = - this->GlobalGenerator->CreateLocalGenerator(this->Makefile); this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest); - // Set CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR. - // Also, some commands need Makefile->GetCurrentSourceDirectory(). - std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - this->Makefile->SetCurrentSourceDirectory(cwd); - this->Makefile->SetCurrentBinaryDirectory(cwd); - // remove all cmake commands which are not scriptable, since they can't be // used in ctest scripts this->CMake->GetState()->RemoveUnscriptableCommands(); diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index 42c2f20..c9d0b6a 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -18,7 +18,6 @@ #include "cmListFileCache.h" class cmMakefile; -class cmLocalGenerator; class cmGlobalGenerator; class cmake; class cmCTestCommand; @@ -166,7 +165,6 @@ private: double ScriptStartTime; cmMakefile *Makefile; - cmLocalGenerator *LocalGenerator; cmGlobalGenerator *GlobalGenerator; cmake *CMake; }; diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index e19e4f4..36576c5 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -12,7 +12,6 @@ #include "cmCTestStartCommand.h" #include "cmCTest.h" -#include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmCTestVC.h" #include "cmGeneratedFileStream.h" diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index f9678e7..968a307 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -24,7 +24,6 @@ #include <cmsys/FStream.hxx> #include "cmMakefile.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmCommand.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" @@ -1593,8 +1592,6 @@ void cmCTestTestHandler::GetListOfTests() cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); - cmsys::auto_ptr<cmLocalGenerator> lg( - gg.CreateLocalGenerator(mf.get())); mf->AddDefinition("CTEST_CONFIGURATION_TYPE", this->CTest->GetConfigType().c_str()); diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 963e501..bf2f34a 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -15,7 +15,6 @@ #include "cmCTest.h" #include "cmake.h" #include "cmMakefile.h" -#include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmVersion.h" #include "cmGeneratedFileStream.h" diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx index 3a74946..01e5253 100644 --- a/Source/cmAddDependenciesCommand.cxx +++ b/Source/cmAddDependenciesCommand.cxx @@ -10,7 +10,6 @@ See the License for more information. ============================================================================*/ #include "cmAddDependenciesCommand.h" -#include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" // cmDependenciesCommand diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index 62fafa5..64d4fca 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -11,7 +11,6 @@ ============================================================================*/ #include "cmBuildCommand.h" -#include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" //---------------------------------------------------------------------- diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 6e55d89..67eb042 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -14,7 +14,6 @@ #include "cmCTest.h" #include "cmake.h" #include "cmMakefile.h" -#include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include <cmsys/Base64.h> #include <cmsys/Directory.hxx> @@ -520,7 +519,6 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); - cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get())); if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf.get()) ) { diff --git a/Source/cmEnableTestingCommand.cxx b/Source/cmEnableTestingCommand.cxx index aa41ef7..6a7fd46 100644 --- a/Source/cmEnableTestingCommand.cxx +++ b/Source/cmEnableTestingCommand.cxx @@ -10,7 +10,6 @@ See the License for more information. ============================================================================*/ #include "cmEnableTestingCommand.h" -#include "cmLocalGenerator.h" // we do this in the final pass so that we now the subdirs have all // been defined diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 96ea77b..6a1d7f3 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -11,7 +11,6 @@ ============================================================================*/ #include "cmExportCommand.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmGeneratedFileStream.h" #include "cmake.h" diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 9a7d73f..881acee 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -436,7 +436,9 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( ImportPropertyMap &properties, std::vector<std::string> &missingTargets) { - cmTarget *target = tei->Target; + cmGeneratorTarget *target = tei->Target->GetMakefile() + ->GetGlobalGenerator() + ->GetGeneratorTarget(tei->Target); assert(preprocessRule == cmGeneratorExpression::InstallInterface); const char *propName = "INTERFACE_INCLUDE_DIRECTORIES"; @@ -450,12 +452,12 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( true); this->ReplaceInstallPrefix(dirs); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs); - std::string exportDirs = cge->Evaluate(target->GetMakefile(), "", - false, target); + std::string exportDirs = cge->Evaluate(target->Target->GetMakefile(), "", + false, target->Target); if (cge->GetHadContextSensitiveCondition()) { - cmMakefile* mf = target->GetMakefile(); + cmMakefile* mf = target->Target->GetMakefile(); std::ostringstream e; e << "Target \"" << target->GetName() << "\" is installed with " "INCLUDES DESTINATION set to a context sensitive path. Paths which " @@ -486,10 +488,10 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( true); if (!prepro.empty()) { - this->ResolveTargetsInGeneratorExpressions(prepro, target, + this->ResolveTargetsInGeneratorExpressions(prepro, target->Target, missingTargets); - if (!checkInterfaceDirs(prepro, target, propName)) + if (!checkInterfaceDirs(prepro, target->Target, propName)) { return; } diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index ba66531..026584c 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -76,8 +76,12 @@ std::string cmExportTryCompileFileGenerator::FindTargets( dummyHead.SetType(cmTarget::EXECUTABLE, "try_compile_dummy_exe"); dummyHead.SetMakefile(tgt->GetMakefile()); - std::string result = cge->Evaluate(tgt->GetMakefile(), this->Config, - false, &dummyHead, tgt, &dagChecker); + cmGeneratorTarget* gtgt = + tgt->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(tgt); + + std::string result = cge->Evaluate(gtgt->Target->GetMakefile(), this->Config, + false, &dummyHead, + gtgt->Target, &dagChecker); const std::set<cmTarget const*> &allTargets = cge->GetAllTargetsSeen(); for(std::set<cmTarget const*>::const_iterator li = allTargets.begin(); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index dfd51c7..7915a6e 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -401,7 +401,9 @@ void cmExtraCodeBlocksGenerator case cmTarget::UTILITY: // can have sources since 2.6.3 { std::vector<cmSourceFile*> sources; - ti->second.GetSourceFiles(sources, + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&ti->second); + gt->GetSourceFiles(sources, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for (std::vector<cmSourceFile*>::const_iterator si=sources.begin(); si!=sources.end(); si++) diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index c2cff14..496c1a8 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -196,7 +196,9 @@ void cmExtraCodeLiteGenerator case cmTarget::MODULE_LIBRARY: { std::vector<cmSourceFile*> sources; - ti->second.GetSourceFiles(sources, + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&ti->second); + gt->GetSourceFiles(sources, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for (std::vector<cmSourceFile*>::const_iterator si=sources.begin(); si!=sources.end(); si++) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 44bf586..6dc18c2 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -562,7 +562,9 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets( // get the files from the source lists then add them to the groups cmTarget* tgt = const_cast<cmTarget*>(&ti->second); std::vector<cmSourceFile*> files; - tgt->GetSourceFiles(files, + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(tgt); + gt->GetSourceFiles(files, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for(std::vector<cmSourceFile*>::const_iterator sfIt = files.begin(); sfIt != files.end(); diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 163a75b..11410a7 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -237,7 +237,7 @@ void cmExtraSublimeTextGenerator:: cmGeneratorTarget *gtgt = this->GlobalGenerator ->GetGeneratorTarget(target); std::vector<cmSourceFile*> sourceFiles; - target->GetSourceFiles(sourceFiles, + gtgt->GetSourceFiles(sourceFiles, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); std::vector<cmSourceFile*>::const_iterator sourceFilesEnd = sourceFiles.end(); diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index 12adfd9..d17d664 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -129,45 +129,6 @@ void cmFLTKWrapUICommand::FinalPass() cmSystemTools::Message(msg.c_str(),"Warning"); return; } - std::vector<cmSourceFile*> srcs; - target->GetSourceFiles(srcs, ""); - bool found = false; - for (unsigned int i = 0; i < srcs.size(); ++i) - { - if (srcs[i]->GetFullPath() == - this->GeneratedSourcesClasses[0]->GetFullPath()) - { - found = true; - break; - } - } - if (!found) - { - std::string msg = - "In CMake 2.2 the FLTK_WRAP_UI command sets a variable to the list of " - "source files that should be added to your executable or library. It " - "appears that you have not added these source files to your target. " - "You should change your CMakeLists.txt file to " - "directly add the generated files to the target. " - "For example FTLK_WRAP_UI(foo src1 src2 src3) " - "will create a variable named foo_FLTK_UI_SRCS that contains the list " - "of sources to add to your target when you call ADD_LIBRARY or " - "ADD_EXECUTABLE. For now CMake will add the sources to your target " - "for you as was done in CMake 2.0 and earlier. In the future this may " - "become an error."; - msg +="The problem was found while processing the source directory: "; - msg += this->Makefile->GetCurrentSourceDirectory(); - cmSystemTools::Message(msg.c_str(),"Warning"); - // first we add the rules for all the .fl to .h and .cxx files - size_t lastHeadersClass = this->GeneratedSourcesClasses.size(); - - // Generate code for all the .fl files - for(size_t classNum = 0; classNum < lastHeadersClass; classNum++) - { - this->Makefile->GetTargets()[this->Target] - .AddSource(this->GeneratedSourcesClasses[classNum]->GetFullPath()); - } - } } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 87faf84..df95d9d 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -15,7 +15,6 @@ #include "cmHexFileConverter.h" #include "cmInstallType.h" #include "cmFileTimeComparison.h" -#include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmCryptoHash.h" #include "cmAlgorithms.h" diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 62598f4..3fb0dc7 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -269,7 +269,9 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) DebugIncludesDone(false), DebugCompileOptionsDone(false), DebugCompileFeaturesDone(false), - DebugCompileDefinitionsDone(false) + DebugCompileDefinitionsDone(false), + DebugSourcesDone(false), + LinkImplementationLanguageIsContextDependent(true) { this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = lg; @@ -296,6 +298,11 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) t->GetCompileDefinitionsEntries(), t->GetCompileDefinitionsBacktraces(), this->CompileDefinitionsEntries); + + CreatePropertyGeneratorExpressions( + t->GetSourceEntries(), + t->GetSourceBacktraces(), + this->SourceEntries, true); } cmGeneratorTarget::~cmGeneratorTarget() @@ -304,6 +311,7 @@ cmGeneratorTarget::~cmGeneratorTarget() cmDeleteAll(this->CompileOptionsEntries); cmDeleteAll(this->CompileFeaturesEntries); cmDeleteAll(this->CompileDefinitionsEntries); + cmDeleteAll(this->SourceEntries); cmDeleteAll(this->LinkInformation); this->LinkInformation.clear(); } @@ -402,12 +410,42 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config, return i->second; } +void cmGeneratorTarget::AddSource(const std::string& src) +{ + this->Target->AddSource(src); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(lfbt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); + cge->SetEvaluateForBuildsystem(true); + this->SourceEntries.push_back( + new TargetPropertyEntry(cge)); + this->SourceFilesMap.clear(); + this->LinkImplementationLanguageIsContextDependent = true; +} + +void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs) +{ + this->Target->AddTracedSources(srcs); + if (!srcs.empty()) + { + std::string srcFiles = cmJoin(srcs, ";"); + this->SourceFilesMap.clear(); + this->LinkImplementationLanguageIsContextDependent = true; + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(lfbt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); + cge->SetEvaluateForBuildsystem(true); + this->SourceEntries.push_back( + new cmGeneratorTarget::TargetPropertyEntry(cge)); + } +} + //---------------------------------------------------------------------------- std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const { - SourceEntriesType::const_iterator i = this->SourceEntries.find(sf); - if(i != this->SourceEntries.end()) + SourceEntriesType::const_iterator i = this->SourceDepends.find(sf); + if(i != this->SourceDepends.end()) { return &i->second.Depends; } @@ -449,7 +487,7 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget const* depTgt, #define IMPLEMENT_VISIT_IMPL(DATA, DATATYPE) \ { \ std::vector<cmSourceFile*> sourceFiles; \ - this->Target->GetSourceFiles(sourceFiles, config); \ + this->GetSourceFiles(sourceFiles, config); \ TagVisitor<DATA ## Tag DATATYPE> visitor(this, data); \ for(std::vector<cmSourceFile*>::const_iterator si = sourceFiles.begin(); \ si != sourceFiles.end(); ++si) \ @@ -802,10 +840,257 @@ bool cmGeneratorTarget::GetPropertyAsBool(const std::string& prop) const } //---------------------------------------------------------------------------- +static void AddInterfaceEntries( + cmGeneratorTarget const* thisTarget, std::string const& config, + std::string const& prop, + std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries) +{ + if(cmLinkImplementationLibraries const* impl = + thisTarget->Target->GetLinkImplementationLibraries(config)) + { + for (std::vector<cmLinkImplItem>::const_iterator + it = impl->Libraries.begin(), end = impl->Libraries.end(); + it != end; ++it) + { + if(it->Target) + { + std::string genex = + "$<TARGET_PROPERTY:" + *it + "," + prop + ">"; + cmGeneratorExpression ge(it->Backtrace); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex); + cge->SetEvaluateForBuildsystem(true); + entries.push_back( + new cmGeneratorTarget::TargetPropertyEntry(cge, *it)); + } + } + } +} + +//---------------------------------------------------------------------------- +static bool processSources(cmGeneratorTarget const* tgt, + const std::vector<cmGeneratorTarget::TargetPropertyEntry*> &entries, + std::vector<std::string> &srcs, + UNORDERED_SET<std::string> &uniqueSrcs, + cmGeneratorExpressionDAGChecker *dagChecker, + std::string const& config, bool debugSources) +{ + cmMakefile *mf = tgt->Target->GetMakefile(); + + bool contextDependent = false; + + for (std::vector<cmGeneratorTarget::TargetPropertyEntry*>::const_iterator + it = entries.begin(), end = entries.end(); it != end; ++it) + { + cmLinkImplItem const& item = (*it)->LinkImplItem; + std::string const& targetName = item; + std::vector<std::string> entrySources; + cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, + config, + false, + tgt->Target, + tgt->Target, + dagChecker), + entrySources); + + if ((*it)->ge->GetHadContextSensitiveCondition()) + { + contextDependent = true; + } + + for(std::vector<std::string>::iterator i = entrySources.begin(); + i != entrySources.end(); ++i) + { + std::string& src = *i; + cmSourceFile* sf = mf->GetOrCreateSource(src); + std::string e; + std::string fullPath = sf->GetFullPath(&e); + if(fullPath.empty()) + { + if(!e.empty()) + { + cmake* cm = mf->GetCMakeInstance(); + cm->IssueMessage(cmake::FATAL_ERROR, e, + tgt->Target->GetBacktrace()); + } + return contextDependent; + } + + if (!targetName.empty() && !cmSystemTools::FileIsFullPath(src.c_str())) + { + std::ostringstream err; + if (!targetName.empty()) + { + err << "Target \"" << targetName << "\" contains relative " + "path in its INTERFACE_SOURCES:\n" + " \"" << src << "\""; + } + else + { + err << "Found relative path while evaluating sources of " + "\"" << tgt->GetName() << "\":\n \"" << src << "\"\n"; + } + tgt->GetLocalGenerator()->IssueMessage(cmake::FATAL_ERROR, err.str()); + return contextDependent; + } + src = fullPath; + } + std::string usedSources; + for(std::vector<std::string>::iterator + li = entrySources.begin(); li != entrySources.end(); ++li) + { + std::string src = *li; + + if(uniqueSrcs.insert(src).second) + { + srcs.push_back(src); + if (debugSources) + { + usedSources += " * " + src + "\n"; + } + } + } + if (!usedSources.empty()) + { + mf->GetCMakeInstance()->IssueMessage(cmake::LOG, + std::string("Used sources for target ") + + tgt->GetName() + ":\n" + + usedSources, (*it)->ge->GetBacktrace()); + } + } + return contextDependent; +} + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::GetSourceFiles(std::vector<std::string> &files, + const std::string& config) const +{ + assert(this->GetType() != cmTarget::INTERFACE_LIBRARY); + + if (!this->Makefile->GetGlobalGenerator()->GetConfigureDoneCMP0026()) + { + // At configure-time, this method can be called as part of getting the + // LOCATION property or to export() a file to be include()d. However + // there is no cmGeneratorTarget at configure-time, so search the SOURCES + // for TARGET_OBJECTS instead for backwards compatibility with OLD + // behavior of CMP0024 and CMP0026 only. + + cmStringRange sourceEntries = this->Target->GetSourceEntries(); + for(cmStringRange::const_iterator + i = sourceEntries.begin(); + i != sourceEntries.end(); ++i) + { + std::string const& entry = *i; + + std::vector<std::string> items; + cmSystemTools::ExpandListArgument(entry, items); + for (std::vector<std::string>::const_iterator + li = items.begin(); li != items.end(); ++li) + { + if(cmHasLiteralPrefix(*li, "$<TARGET_OBJECTS:") && + (*li)[li->size() - 1] == '>') + { + continue; + } + files.push_back(*li); + } + } + return; + } + + std::vector<std::string> debugProperties; + const char *debugProp = + this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); + if (debugProp) + { + cmSystemTools::ExpandListArgument(debugProp, debugProperties); + } + + bool debugSources = !this->DebugSourcesDone + && std::find(debugProperties.begin(), + debugProperties.end(), + "SOURCES") + != debugProperties.end(); + + if (this->Makefile->GetGlobalGenerator()->GetConfigureDoneCMP0026()) + { + this->DebugSourcesDone = true; + } + + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), + "SOURCES", 0, 0); + + UNORDERED_SET<std::string> uniqueSrcs; + bool contextDependentDirectSources = processSources(this, + this->SourceEntries, + files, + uniqueSrcs, + &dagChecker, + config, + debugSources); + + std::vector<cmGeneratorTarget::TargetPropertyEntry*> + linkInterfaceSourcesEntries; + + AddInterfaceEntries( + this, config, "INTERFACE_SOURCES", + linkInterfaceSourcesEntries); + + std::vector<std::string>::size_type numFilesBefore = files.size(); + bool contextDependentInterfaceSources = processSources(this, + linkInterfaceSourcesEntries, + files, + uniqueSrcs, + &dagChecker, + config, + debugSources); + + if (!contextDependentDirectSources + && !(contextDependentInterfaceSources && numFilesBefore < files.size())) + { + this->LinkImplementationLanguageIsContextDependent = false; + } + + cmDeleteAll(linkInterfaceSourcesEntries); +} + +//---------------------------------------------------------------------------- void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files, const std::string& config) const { - this->Target->GetSourceFiles(files, config); + + // Lookup any existing link implementation for this configuration. + std::string key = cmSystemTools::UpperCase(config); + + if(!this->LinkImplementationLanguageIsContextDependent) + { + files = this->SourceFilesMap.begin()->second; + return; + } + + SourceFilesMapType::iterator + it = this->SourceFilesMap.find(key); + if(it != this->SourceFilesMap.end()) + { + files = it->second; + } + else + { + std::vector<std::string> srcs; + this->GetSourceFiles(srcs, config); + + std::set<cmSourceFile*> emitted; + + for(std::vector<std::string>::const_iterator i = srcs.begin(); + i != srcs.end(); ++i) + { + cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i); + if (emitted.insert(sf).second) + { + files.push_back(sf); + } + } + this->SourceFilesMap[key] = files; + } } //---------------------------------------------------------------------------- @@ -1683,7 +1968,7 @@ cmTargetTraceDependencies ci != configs.end(); ++ci) { std::vector<cmSourceFile*> sources; - this->Target->GetSourceFiles(sources, *ci); + this->GeneratorTarget->GetSourceFiles(sources, *ci); for(std::vector<cmSourceFile*>::const_iterator si = sources.begin(); si != sources.end(); ++si) { @@ -1723,7 +2008,7 @@ void cmTargetTraceDependencies::Trace() // Get the next source from the queue. cmSourceFile* sf = this->SourceQueue.front(); this->SourceQueue.pop(); - this->CurrentEntry = &this->GeneratorTarget->SourceEntries[sf]; + this->CurrentEntry = &this->GeneratorTarget->SourceDepends[sf]; // Queue dependencies added explicitly by the user. if(const char* additionalDeps = sf->GetProperty("OBJECT_DEPENDS")) @@ -1755,7 +2040,7 @@ void cmTargetTraceDependencies::Trace() } this->CurrentEntry = 0; - this->Target->AddTracedSources(this->NewSources); + this->GeneratorTarget->AddTracedSources(this->NewSources); } //---------------------------------------------------------------------------- @@ -2167,34 +2452,6 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt, } } - -//---------------------------------------------------------------------------- -static void AddInterfaceEntries( - cmGeneratorTarget const* thisTarget, std::string const& config, - std::string const& prop, - std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries) -{ - if(cmLinkImplementationLibraries const* impl = - thisTarget->Target->GetLinkImplementationLibraries(config)) - { - for (std::vector<cmLinkImplItem>::const_iterator - it = impl->Libraries.begin(), end = impl->Libraries.end(); - it != end; ++it) - { - if(it->Target) - { - std::string genex = - "$<TARGET_PROPERTY:" + *it + "," + prop + ">"; - cmGeneratorExpression ge(it->Backtrace); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex); - cge->SetEvaluateForBuildsystem(true); - entries.push_back( - new cmGeneratorTarget::TargetPropertyEntry(cge, *it)); - } - } - } -} - //---------------------------------------------------------------------------- std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(const std::string& config, @@ -4444,12 +4701,12 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles( std::vector<std::string>::const_iterator it = configs.begin(); const std::string& firstConfig = *it; - this->Target->GetSourceFiles(files, firstConfig); + this->GetSourceFiles(files, firstConfig); for ( ; it != configs.end(); ++it) { std::vector<cmSourceFile*> configFiles; - this->Target->GetSourceFiles(configFiles, *it); + this->GetSourceFiles(configFiles, *it); if (configFiles != files) { std::string firstConfigFiles; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 916f281..e8c5e04 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -296,6 +296,9 @@ public: // Get the target base name. std::string GetOutputName(const std::string& config, bool implib) const; + void AddSource(const std::string& src); + void AddTracedSources(std::vector<std::string> const& srcs); + /** * Flags for a given source file as used in this target. Typically assigned * via SET_TARGET_PROPERTIES when the property is a list of source files. @@ -370,7 +373,7 @@ private: friend class cmTargetTraceDependencies; struct SourceEntry { std::vector<cmSourceFile*> Depends; }; typedef std::map<cmSourceFile const*, SourceEntry> SourceEntriesType; - SourceEntriesType SourceEntries; + SourceEntriesType SourceDepends; mutable std::map<cmSourceFile const*, std::string> Objects; std::set<cmSourceFile const*> ExplicitObjectName; mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache; @@ -438,10 +441,15 @@ private: GetImportLinkInterface(const std::string& config, cmTarget const* head, bool usage_requirements_only) const; + typedef std::map<std::string, std::vector<cmSourceFile*> > + SourceFilesMapType; + mutable SourceFilesMapType SourceFilesMap; + std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries; std::vector<TargetPropertyEntry*> CompileOptionsEntries; std::vector<TargetPropertyEntry*> CompileFeaturesEntries; std::vector<TargetPropertyEntry*> CompileDefinitionsEntries; + std::vector<TargetPropertyEntry*> SourceEntries; void ExpandLinkItems(std::string const& prop, std::string const& value, std::string const& config, cmTarget const* headTarget, @@ -451,6 +459,9 @@ private: void LookupLinkItems(std::vector<std::string> const& names, std::vector<cmLinkItem>& items) const; + void GetSourceFiles(std::vector<std::string>& files, + const std::string& config) const; + typedef std::pair<std::string, bool> OutputNameKey; typedef std::map<OutputNameKey, std::string> OutputNameMapType; mutable OutputNameMapType OutputNameMap; @@ -459,6 +470,8 @@ private: mutable bool DebugCompileOptionsDone; mutable bool DebugCompileFeaturesDone; mutable bool DebugCompileDefinitionsDone; + mutable bool DebugSourcesDone; + mutable bool LinkImplementationLanguageIsContextDependent; public: std::vector<cmTarget const*> const& diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index 248ce59..1a91183 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -12,7 +12,6 @@ #include "cmGetCMakePropertyCommand.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmake.h" #include "cmState.h" #include "cmAlgorithms.h" diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 4c42f53..617a811 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -15,7 +15,6 @@ #include "cmState.h" #include "cmTest.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmSourceFile.h" #include "cmPropertyDefinition.h" diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index cae5c2f..bfcef43 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -27,7 +27,7 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget *target) , LocalGenerator(static_cast<cmLocalGhsMultiGenerator *>( target->GetLocalGenerator())) , Makefile(target->Target->GetMakefile()) - , TargetGroup(DetermineIfTargetGroup(target->Target)) + , TargetGroup(DetermineIfTargetGroup(target)) , DynamicDownload(false) { this->RelBuildFilePath = this->GetRelBuildFilePath(target->Target); @@ -172,16 +172,17 @@ std::vector<cmSourceFile *> cmGhsMultiTargetGenerator::GetSources() const { std::vector<cmSourceFile *> output; std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->Target->GetSourceFiles(output, config); + this->GeneratorTarget->GetSourceFiles(output, config); return output; } GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag() const { - return cmGhsMultiTargetGenerator::GetGpjTag(this->Target); + return cmGhsMultiTargetGenerator::GetGpjTag(this->GeneratorTarget); } -GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag(const cmTarget *target) +GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag( + const cmGeneratorTarget *target) { GhsMultiGpj::Types output; if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup(target)) @@ -566,12 +567,13 @@ bool cmGhsMultiTargetGenerator::IsNotKernel(std::string const &config, return output; } -bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup(const cmTarget *target) +bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup( + const cmGeneratorTarget *target) { bool output = false; std::vector<cmSourceFile *> sources; std::string config = - target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); + target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); target->GetSourceFiles(sources, config); for (std::vector<cmSourceFile *>::const_iterator sources_i = sources.begin(); sources.end() != sources_i; ++sources_i) diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index c29a31e..d1c17f4 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -36,7 +36,7 @@ public: bool IncludeThisTarget(); std::vector<cmSourceFile *> GetSources() const; GhsMultiGpj::Types GetGpjTag() const; - static GhsMultiGpj::Types GetGpjTag(const cmTarget *target); + static GhsMultiGpj::Types GetGpjTag(const cmGeneratorTarget* target); const char *GetAbsBuildFilePath() const { return this->AbsBuildFilePath.c_str(); @@ -95,7 +95,7 @@ private: std::string GetOutputFilename(const std::string &config) const; bool IsNotKernel(std::string const &config, const std::string &language); - static bool DetermineIfTargetGroup(const cmTarget *target); + static bool DetermineIfTargetGroup(const cmGeneratorTarget* target); bool DetermineIfDynamicDownload(std::string const &config, const std::string &language); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4a48b5d..eb4dfee 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1108,16 +1108,16 @@ void cmGlobalGenerator::Configure() this->FirstTimeProgress = 0.0f; this->ClearGeneratorMembers(); - cmMakefile* dirMf = - new cmMakefile(this, this->GetCMakeInstance()->GetCurrentSnapshot()); - this->Makefiles.push_back(dirMf); + cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot(); - // set the Start directories - dirMf->SetCurrentSourceDirectory + snapshot.GetDirectory().SetCurrentSource (this->CMakeInstance->GetHomeDirectory()); - dirMf->SetCurrentBinaryDirectory + snapshot.GetDirectory().SetCurrentBinary (this->CMakeInstance->GetHomeOutputDirectory()); + cmMakefile* dirMf = new cmMakefile(this, snapshot); + this->Makefiles.push_back(dirMf); + this->BinaryDirectories.insert( this->CMakeInstance->GetHomeOutputDirectory()); @@ -1251,7 +1251,7 @@ bool cmGlobalGenerator::Compute() #ifdef CMAKE_BUILD_WITH_CMAKE // Iterate through all targets and set up automoc for those which have // the AUTOMOC, AUTOUIC or AUTORCC property set - std::vector<cmTarget const*> autogenTargets = + std::vector<cmGeneratorTarget const*> autogenTargets = this->CreateQtAutoGeneratorsTargets(); #endif @@ -1264,8 +1264,8 @@ bool cmGlobalGenerator::Compute() } #ifdef CMAKE_BUILD_WITH_CMAKE - for (std::vector<cmTarget const*>::iterator it = autogenTargets.begin(); - it != autogenTargets.end(); ++it) + for (std::vector<cmGeneratorTarget const*>::iterator it = + autogenTargets.begin(); it != autogenTargets.end(); ++it) { cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(*it); } @@ -1282,12 +1282,7 @@ bool cmGlobalGenerator::Compute() } } - return true; -} - -void cmGlobalGenerator::Generate() -{ - unsigned int i; + this->AddExtraIDETargets(); // Trace the dependencies, after that no custom commands should be added // because their dependencies might not be handled correctly @@ -1307,22 +1302,27 @@ void cmGlobalGenerator::Generate() // Compute the inter-target dependencies. if(!this->ComputeTargetDepends()) { - return; + return false; + } + + for (i = 0; i < this->LocalGenerators.size(); ++i) + { + this->LocalGenerators[i]->ComputeHomeRelativeOutputPath(); } + return true; +} + +void cmGlobalGenerator::Generate() +{ // Create a map from local generator to the complete set of targets // it builds by default. this->InitializeProgressMarks(); this->ProcessEvaluationFiles(); - for (i = 0; i < this->LocalGenerators.size(); ++i) - { - this->LocalGenerators[i]->ComputeHomeRelativeOutputPath(); - } - // Generate project files - for (i = 0; i < this->LocalGenerators.size(); ++i) + for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { this->SetCurrentMakefile(this->LocalGenerators[i]->GetMakefile()); this->LocalGenerators[i]->Generate(); @@ -1403,18 +1403,18 @@ bool cmGlobalGenerator::ComputeTargetDepends() } //---------------------------------------------------------------------------- -std::vector<const cmTarget*> +std::vector<const cmGeneratorTarget*> cmGlobalGenerator::CreateQtAutoGeneratorsTargets() { - std::vector<const cmTarget*> autogenTargets; + std::vector<const cmGeneratorTarget*> autogenTargets; #ifdef CMAKE_BUILD_WITH_CMAKE for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) { cmTargets& targets = this->LocalGenerators[i]->GetMakefile()->GetTargets(); - std::vector<std::string> targetNames; - targetNames.reserve(targets.size()); + std::vector<cmGeneratorTarget*> filteredTargets; + filteredTargets.reserve(targets.size()); for(cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti) { @@ -1449,17 +1449,17 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets() continue; } - cmQtAutoGeneratorInitializer::InitializeAutogenSources(&ti->second); - targetNames.push_back(ti->second.GetName()); + cmGeneratorTarget* gt = this->GetGeneratorTarget(&ti->second); + + cmQtAutoGeneratorInitializer::InitializeAutogenSources(gt); + filteredTargets.push_back(gt); } - for(std::vector<std::string>::iterator ti = targetNames.begin(); - ti != targetNames.end(); ++ti) + for(std::vector<cmGeneratorTarget*>::iterator ti = filteredTargets.begin(); + ti != filteredTargets.end(); ++ti) { - cmTarget* target = this->LocalGenerators[i] - ->GetMakefile()->FindTarget(*ti, true); cmQtAutoGeneratorInitializer::InitializeAutogenTarget( - this->LocalGenerators[i], target); - autogenTargets.push_back(target); + this->LocalGenerators[i], *ti); + autogenTargets.push_back(*ti); } } #endif @@ -2949,10 +2949,12 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target) { configs.push_back(""); } + cmGeneratorTarget* gt = + this->GetGeneratorTarget(target); for(std::vector<std::string>::const_iterator ci = configs.begin(); ci != configs.end(); ++ci) { - target->GetSourceFiles(sources, *ci); + gt->GetSourceFiles(sources, *ci); } std::vector<cmSourceFile*>::const_iterator sourcesEnd = cmRemoveDuplicates(sources); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index ba74c9e..b22c695 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -83,7 +83,8 @@ public: */ virtual void Configure(); - virtual bool Compute(); + bool Compute(); + virtual void AddExtraIDETargets() {} enum TargetTypes { AllTargets, @@ -384,7 +385,7 @@ protected: virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const; - std::vector<cmTarget const*> CreateQtAutoGeneratorsTargets(); + std::vector<const cmGeneratorTarget*> CreateQtAutoGeneratorsTargets(); std::string SelectMakeProgram(const std::string& makeProgram, const std::string& makeDefault = "") const; diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 6dde1e3..87cf58f 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -509,7 +509,8 @@ void cmGlobalGhsMultiGenerator::UpdateBuildFiles( splitPath.back()); *this->TargetFolderBuildStreams[folderName] << foldNameRelBuildFile << " "; - GhsMultiGpj::WriteGpjTag(cmGhsMultiTargetGenerator::GetGpjTag(tgt), + GhsMultiGpj::WriteGpjTag(cmGhsMultiTargetGenerator::GetGpjTag( + tgtsI->second), this->TargetFolderBuildStreams[folderName]); } } @@ -520,7 +521,8 @@ bool cmGlobalGhsMultiGenerator::IsTgtForBuild(const cmTarget *tgt) const std::string config = tgt->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); std::vector<cmSourceFile *> tgtSources; - tgt->GetSourceFiles(tgtSources, config); + cmGeneratorTarget* gt = this->GetGeneratorTarget(tgt); + gt->GetSourceFiles(tgtSources, config); bool tgtInBuild = true; char const *excludeFromAll = tgt->GetProperty("EXCLUDE_FROM_ALL"); if (NULL != excludeFromAll && '1' == excludeFromAll[0] && diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 138ddbb..c40f846 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -139,7 +139,9 @@ bool cmGlobalKdevelopGenerator ti != targets.end(); ti++) { std::vector<cmSourceFile*> sources; - ti->second.GetSourceFiles(sources, ti->second.GetMakefile() + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&ti->second); + gt->GetSourceFiles(sources, ti->second.GetMakefile() ->GetSafeDefinition("CMAKE_BUILD_TYPE")); for (std::vector<cmSourceFile*>::const_iterator si=sources.begin(); si!=sources.end(); si++) diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 0064713..cb13fcf 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -585,12 +585,11 @@ void cmGlobalUnixMakefileGenerator3 else { cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot(); - mf = new cmMakefile(this, snapshot); - // set the Start directories - mf->SetCurrentSourceDirectory + snapshot.GetDirectory().SetCurrentSource (this->CMakeInstance->GetHomeDirectory()); - mf->SetCurrentBinaryDirectory + snapshot.GetDirectory().SetCurrentBinary (this->CMakeInstance->GetHomeOutputDirectory()); + mf = new cmMakefile(this, snapshot); } std::string tname = targetName; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 44d632d..161b532 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -176,7 +176,14 @@ cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts, //---------------------------------------------------------------------------- bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) { - if (this->SystemName == "WindowsCE") + if (this->SystemName == "Windows") + { + if (!this->InitializeWindows(mf)) + { + return false; + } + } + else if (this->SystemName == "WindowsCE") { this->SystemIsWindowsCE = true; if (!this->InitializeWindowsCE(mf)) @@ -184,7 +191,7 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) return false; } } - else if(this->SystemName == "WindowsPhone") + else if (this->SystemName == "WindowsPhone") { this->SystemIsWindowsPhone = true; if(!this->InitializeWindowsPhone(mf)) @@ -192,7 +199,7 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) return false; } } - else if(this->SystemName == "WindowsStore") + else if (this->SystemName == "WindowsStore") { this->SystemIsWindowsStore = true; if(!this->InitializeWindowsStore(mf)) @@ -229,6 +236,12 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) } //---------------------------------------------------------------------------- +bool cmGlobalVisualStudio10Generator::InitializeWindows(cmMakefile*) +{ + return true; +} + +//---------------------------------------------------------------------------- bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf) { if (this->DefaultPlatformName != "Win32") @@ -312,19 +325,9 @@ cmLocalGenerator* cmGlobalVisualStudio10Generator::CreateLocalGenerator( return new cmLocalVisualStudio10Generator(this, mf); } -//---------------------------------------------------------------------------- -bool cmGlobalVisualStudio10Generator::Compute() -{ - if (!cmGlobalVisualStudio8Generator::Compute()) - { - return false; - } - this->LongestSource = LongestSourcePath(); - return true; -} - void cmGlobalVisualStudio10Generator::Generate() { + this->LongestSource = LongestSourcePath(); this->cmGlobalVisualStudio8Generator::Generate(); if(this->LongestSource.Length > 0) { diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 8de7b09..7600a0d 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -45,8 +45,6 @@ public: std::vector<std::string> const& makeOptions = std::vector<std::string>() ); - virtual bool Compute(); - ///! create the correct local generator virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf); @@ -74,6 +72,10 @@ public: /** Return the CMAKE_SYSTEM_VERSION. */ std::string const& GetSystemVersion() const { return this->SystemVersion; } + /** Return the Windows version targeted on VS 2015 and above. */ + std::string const& GetWindowsTargetPlatformVersion() const + { return this->WindowsTargetPlatformVersion; } + /** Return true if building for WindowsCE */ bool TargetsWindowsCE() const { return this->SystemIsWindowsCE; } @@ -105,6 +107,7 @@ public: protected: virtual void Generate(); virtual bool InitializeSystem(cmMakefile* mf); + virtual bool InitializeWindows(cmMakefile* mf); virtual bool InitializeWindowsCE(cmMakefile* mf); virtual bool InitializeWindowsPhone(cmMakefile* mf); virtual bool InitializeWindowsStore(cmMakefile* mf); @@ -119,6 +122,7 @@ protected: std::string GeneratorToolset; std::string DefaultPlatformToolset; + std::string WindowsTargetPlatformVersion; std::string SystemName; std::string SystemVersion; std::string NsightTegraVersion; diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index d73eedf..41825fb 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -111,6 +111,84 @@ cmGlobalVisualStudio14Generator::MatchesGeneratorName( } //---------------------------------------------------------------------------- +bool cmGlobalVisualStudio14Generator::InitializeWindows(cmMakefile* mf) +{ + if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) + { + return this->SelectWindows10SDK(mf); + } + return true; +} + +//---------------------------------------------------------------------------- +bool cmGlobalVisualStudio14Generator::InitializeWindowsStore(cmMakefile* mf) +{ + std::ostringstream e; + if(!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset)) + { + if(this->DefaultPlatformToolset.empty()) + { + e << this->GetName() << " supports Windows Store '8.0', '8.1' and " + "'10.0', but not '" << this->SystemVersion << + "'. Check CMAKE_SYSTEM_VERSION."; + } + else + { + e << "A Windows Store component with CMake requires both the Windows " + << "Desktop SDK as well as the Windows Store '" << this->SystemVersion + << "' SDK. Please make sure that you have both installed"; + } + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } + if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) + { + return this->SelectWindows10SDK(mf); + } + return true; +} + +//---------------------------------------------------------------------------- +bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf) +{ + // Find the default version of the Windows 10 SDK. + this->WindowsTargetPlatformVersion = this->GetWindows10SDKVersion(); + if (this->WindowsTargetPlatformVersion.empty()) + { + std::ostringstream e; + e << "Could not find an appropriate version of the Windows 10 SDK" + << " installed on this machine"; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } + mf->AddDefinition("CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION", + this->WindowsTargetPlatformVersion.c_str()); + return true; +} + +//---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio14Generator::SelectWindowsStoreToolset( + std::string& toolset) const +{ + if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) + { + if (this->IsWindowsStoreToolsetInstalled() && + this->IsWindowsDesktopToolsetInstalled()) + { + toolset = "v140"; + return true; + } + else + { + return false; + } + } + return + this->cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset(toolset); +} + +//---------------------------------------------------------------------------- void cmGlobalVisualStudio14Generator::WriteSLNHeader(std::ostream& fout) { // Visual Studio 14 writes .sln format 12.00 @@ -137,3 +215,77 @@ cmGlobalVisualStudio14Generator::IsWindowsDesktopToolsetInstalled() const return cmSystemTools::GetRegistrySubKeys(desktop10Key, vc14, cmSystemTools::KeyWOW64_32); } + +//---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio14Generator::IsWindowsStoreToolsetInstalled() const +{ + const char universal10Key[] = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" + "VisualStudio\\14.0\\Setup\\Build Tools for Windows 10;SrcPath"; + + std::string win10SDK; + return cmSystemTools::ReadRegistryValue(universal10Key, + win10SDK, cmSystemTools::KeyWOW64_32); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion() +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + // This logic is taken from the vcvarsqueryregistry.bat file from VS2015 + // Try HKLM and then HKCU. + std::string win10Root; + if (!cmSystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" + "Windows Kits\\Installed Roots;KitsRoot10", win10Root, + cmSystemTools::KeyWOW64_32) && + !cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\" + "Windows Kits\\Installed Roots;KitsRoot10", win10Root, + cmSystemTools::KeyWOW64_32)) + { + return std::string(); + } + + std::vector<std::string> sdks; + std::string path = win10Root + "Include/*"; + // Grab the paths of the different SDKs that are installed + cmSystemTools::GlobDirs(path, sdks); + if (!sdks.empty()) + { + // Only use the filename, which will be the SDK version. + for (std::vector<std::string>::iterator i = sdks.begin(); + i != sdks.end(); ++i) + { + *i = cmSystemTools::GetFilenameName(*i); + } + + // Sort the results to make sure we select the most recent one that + // has a version less or equal to our version of the operating system + std::sort(sdks.begin(), sdks.end(), cmSystemTools::VersionCompareGreater); + + // Select a suitable SDK version. + if (this->SystemVersion == "10.0") + { + // Use the latest Windows 10 SDK since no build version was given. + return sdks.at(0); + } + else + { + // Find the SDK less or equal to our specified version + for (std::vector<std::string>::iterator i = sdks.begin(); + i != sdks.end(); ++i) + { + if (!cmSystemTools::VersionCompareGreater(*i, this->SystemVersion)) + { + // This is the most recent SDK that we can run safely + return *i; + } + } + } + } +#endif + // Return an empty string + return std::string(); +} diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 02c6274..76c15d9 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -30,12 +30,23 @@ public: virtual const char* GetToolsVersion() { return "14.0"; } protected: + virtual bool InitializeWindows(cmMakefile* mf); + virtual bool InitializeWindowsStore(cmMakefile* mf); + virtual bool SelectWindowsStoreToolset(std::string& toolset) const; + + // These aren't virtual because we need to check if the selected version + // of the toolset is installed + bool IsWindowsStoreToolsetInstalled() const; + virtual const char* GetIDEVersion() { return "14.0"; } + virtual bool SelectWindows10SDK(cmMakefile* mf); // Used to verify that the Desktop toolset for the current generator is // installed on the machine. virtual bool IsWindowsDesktopToolsetInstalled() const; + std::string GetWindows10SDKVersion(); + private: class Factory; }; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 70c00e9..ab9d7e7 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -336,7 +336,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() no_main_dependency, commandLines, "Checking Build System", no_working_directory, true)) { - tgt->AddSource(file->GetFullPath()); + gt->AddSource(file->GetFullPath()); } else { @@ -348,13 +348,9 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() } //---------------------------------------------------------------------------- -bool cmGlobalVisualStudio8Generator::Compute() +void cmGlobalVisualStudio8Generator::AddExtraIDETargets() { - if (!cmGlobalVisualStudio7Generator::Compute()) - { - return false; - } - + cmGlobalVisualStudio7Generator::AddExtraIDETargets(); if(this->AddCheckTarget()) { // All targets depend on the build-system check target. @@ -368,7 +364,6 @@ bool cmGlobalVisualStudio8Generator::Compute() } } } - return true; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 1c61103..9d6c64f 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -67,7 +67,7 @@ public: return !this->WindowsCEVersion.empty(); } protected: - virtual bool Compute(); + virtual void AddExtraIDETargets(); virtual const char* GetIDEVersion() { return "8.0"; } virtual std::string FindDevEnvCommand(); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 7552d67..d45aa27 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -64,13 +64,8 @@ std::string cmGlobalVisualStudioGenerator::GetRegistryBase( } //---------------------------------------------------------------------------- -bool cmGlobalVisualStudioGenerator::Compute() +void cmGlobalVisualStudioGenerator::AddExtraIDETargets() { - if (!cmGlobalGenerator::Compute()) - { - return false; - } - // Add a special target that depends on ALL projects for easy build // of one configuration only. const char* no_working_dir = 0; @@ -144,7 +139,6 @@ bool cmGlobalVisualStudioGenerator::Compute() static_cast<cmLocalVisualStudioGenerator*>(*lgi); lg->AddCMakeListsRules(); } - return true; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index c940eb3..41d0b88 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -111,7 +111,7 @@ public: cmGeneratorTarget*, std::vector<cmCustomCommand>& commands, std::string const& configName); protected: - virtual bool Compute(); + virtual void AddExtraIDETargets(); // Does this VS version link targets to each other if there are // dependencies in the SLN file? This was done for VS versions diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 33babec..3d52e3a 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -376,14 +376,8 @@ cmGlobalXCodeGenerator::CreateLocalGenerator(cmMakefile* mf) return new cmLocalXCodeGenerator(this, mf); } -//---------------------------------------------------------------------------- -bool cmGlobalXCodeGenerator::Compute() +void cmGlobalXCodeGenerator::AddExtraIDETargets() { - if (!cmGlobalGenerator::Compute()) - { - return false; - } - std::map<std::string, std::vector<cmLocalGenerator*> >::iterator it; // make sure extra targets are added before calling // the parent generate which will call trace depends @@ -394,7 +388,6 @@ bool cmGlobalXCodeGenerator::Compute() // add ALL_BUILD, INSTALL, etc this->AddExtraTargets(root, it->second); } - return true; } void cmGlobalXCodeGenerator::Generate() @@ -470,7 +463,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, std::string listfile = mf->GetCurrentSourceDirectory(); listfile += "/"; listfile += "CMakeLists.txt"; - allbuild->AddSourceCMP0049(listfile.c_str()); + allBuildGt->AddSource(listfile.c_str()); // Add XCODE depend helper std::string dir = mf->GetCurrentBinaryDirectory(); @@ -560,11 +553,13 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, allbuild->AddUtility(target.GetName()); } + cmGeneratorTarget* targetGT = this->GetGeneratorTarget(&target); + // Refer to the build configuration file for easy editing. listfile = lg->GetMakefile()->GetCurrentSourceDirectory(); listfile += "/"; listfile += "CMakeLists.txt"; - target.AddSourceCMP0049(listfile.c_str()); + targetGT->AddSource(listfile.c_str()); } } } @@ -1408,7 +1403,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget) if(cmSourceFile* sf = mf->GetOrCreateSource(fname.c_str())) { sf->SetProperty("LANGUAGE", llang.c_str()); - cmtarget.AddSource(fname); + gtgt->AddSource(fname); } } @@ -3076,17 +3071,18 @@ bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, continue; } + cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget); + // add the soon to be generated Info.plist file as a source for a // MACOSX_BUNDLE file if(cmtarget.GetPropertyAsBool("MACOSX_BUNDLE")) { std::string plist = this->ComputeInfoPListLocation(cmtarget); mf->GetOrCreateSource(plist, true); - cmtarget.AddSource(plist); + gtgt->AddSource(plist); } std::vector<cmSourceFile*> classes; - cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget); if (!gtgt->GetConfigCommonSourceFiles(classes)) { return false; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 102c036..9daf0ab 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -87,7 +87,7 @@ public: virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); void AppendFlag(std::string& flags, std::string const& flag); protected: - virtual bool Compute(); + virtual void AddExtraIDETargets(); virtual void Generate(); private: cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget, diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 20448c1..a03808f 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmIfCommand.h" #include "cmStringCommand.h" +#include "cmOutputConverter.h" #include "cmConditionEvaluator.h" diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index bff2986..5050229 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -12,7 +12,7 @@ #include "cmListFileCache.h" #include "cmListFileLexer.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmVersion.h" diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f4de0f2..b26151c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1180,7 +1180,7 @@ void cmLocalGenerator::AddCompileOptions( //---------------------------------------------------------------------------- void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, - cmGeneratorTarget* target, + cmGeneratorTarget const* target, const std::string& lang, const std::string& config, bool stripImplicitInclDirs @@ -1542,7 +1542,9 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, this->Makefile->GetSafeDefinition("CMAKE_LIBRARY_PATH_TERMINATOR"); // Flags to link an executable to shared libraries. - if( tgt.GetType() == cmTarget::EXECUTABLE ) + if (tgt.GetType() == cmTarget::EXECUTABLE && + this->StateSnapshot.GetState()-> + GetGlobalPropertyAsBool("TARGET_SUPPORTS_SHARED_LIBS")) { bool add_shlib_flags = false; switch(tgt.Target->GetPolicyStatusCMP0065()) diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 6ea414a..33fede1 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -171,7 +171,7 @@ public: /** Get the include flags for the current makefile and language. */ void GetIncludeDirectories(std::vector<std::string>& dirs, - cmGeneratorTarget* target, + cmGeneratorTarget const* target, const std::string& lang = "C", const std::string& config = "", bool stripImplicitInclDirs = true) const; diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index cc94cd4..ab215d1 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -243,7 +243,8 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) no_working_directory, true); if(this->Makefile->GetSource(makefileIn.c_str())) { - tgt.AddSource(makefileIn); + cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&tgt); + gt->AddSource(makefileIn); } else { @@ -595,7 +596,8 @@ cmLocalVisualStudio6Generator origCommand.GetCommandLines(), comment, origCommand.GetWorkingDirectory().c_str())) { - target.AddSource(outsf->GetFullPath()); + cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&target); + gt->AddSource(outsf->GetFullPath()); } // Replace the dependencies with the output of this rule so that the diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index a4bce8a..8924564 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -112,7 +112,9 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules() } if(l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET) { - l->second.AddSource(sf->GetFullPath()); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&l->second); + gt->AddSource(sf->GetFullPath()); } } } @@ -148,7 +150,9 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() force.c_str(), no_depends, no_main_dependency, force_commands, " ", 0, true)) { - tgt.AddSource(file->GetFullPath()); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&tgt); + gt->AddSource(file->GetFullPath()); } } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c70756a..c060505 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -120,15 +120,34 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator, this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$"); #endif + this->AddDefinition("CMAKE_SOURCE_DIR", + this->GetCMakeInstance()->GetHomeDirectory()); + this->AddDefinition("CMAKE_BINARY_DIR", + this->GetCMakeInstance()->GetHomeOutputDirectory()); { - const char* dir = this->GetCMakeInstance()->GetHomeDirectory(); - this->AddDefinition("CMAKE_SOURCE_DIR", dir); - this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", dir); + const char* dir = this->StateSnapshot.GetDirectory().GetCurrentSource(); + if (dir) + { + this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", dir); + } + else + { + this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", + this->GetCMakeInstance()->GetHomeDirectory()); + } } { - const char* dir = this->GetCMakeInstance()->GetHomeOutputDirectory(); - this->AddDefinition("CMAKE_BINARY_DIR", dir); - this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", dir); + const char* dir = this->StateSnapshot.GetDirectory().GetCurrentBinary(); + if (dir) + { + cmSystemTools::MakeDirectory(dir); + this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", dir); + } + else + { + this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", + this->GetCMakeInstance()->GetHomeOutputDirectory()); + } } } @@ -1472,13 +1491,6 @@ void cmMakefile::AddLinkLibrary(const std::string& lib) void cmMakefile::InitializeFromParent(cmMakefile* parent) { - this->StateSnapshot.InitializeFromParent(); - - this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", - this->GetCurrentSourceDirectory()); - this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", - this->GetCurrentBinaryDirectory()); - this->SystemIncludeDirectories = parent->SystemIncludeDirectories; // define flags @@ -1749,12 +1761,12 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, this->ContextStack.back()->Name, this->ContextStack.back()->Line); + newSnapshot.GetDirectory().SetCurrentSource(srcPath); + newSnapshot.GetDirectory().SetCurrentBinary(binPath); + cmMakefile* subMf = new cmMakefile(this->GlobalGenerator, newSnapshot); this->GetGlobalGenerator()->AddMakefile(subMf); - // set the subdirs start dirs - subMf->SetCurrentSourceDirectory(srcPath); - subMf->SetCurrentBinaryDirectory(binPath); if(excludeFromAll) { subMf->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); @@ -1770,26 +1782,11 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, } } -void cmMakefile::SetCurrentSourceDirectory(const std::string& dir) -{ - this->StateSnapshot.GetDirectory().SetCurrentSource(dir); - this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", - this->StateSnapshot.GetDirectory().GetCurrentSource()); -} - const char* cmMakefile::GetCurrentSourceDirectory() const { return this->StateSnapshot.GetDirectory().GetCurrentSource(); } -void cmMakefile::SetCurrentBinaryDirectory(const std::string& dir) -{ - this->StateSnapshot.GetDirectory().SetCurrentBinary(dir); - const char* binDir = this->StateSnapshot.GetDirectory().GetCurrentBinary(); - cmSystemTools::MakeDirectory(binDir); - this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", binDir); -} - const char* cmMakefile::GetCurrentBinaryDirectory() const { return this->StateSnapshot.GetDirectory().GetCurrentBinary(); @@ -3218,7 +3215,7 @@ void cmMakefile::AddDefaultDefinitions() //---------------------------------------------------------------------------- std::string cmMakefile::GetConfigurations(std::vector<std::string>& configs, - bool single) const + bool singleConfig) const { if(this->GetGlobalGenerator()->IsMultiConfig()) { @@ -3232,7 +3229,7 @@ cmMakefile::GetConfigurations(std::vector<std::string>& configs, else { const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE"); - if(single && !buildType.empty()) + if(singleConfig && !buildType.empty()) { configs.push_back(buildType); } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 8724c6e..459d34c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -353,9 +353,7 @@ public: */ void SetArgcArgv(const std::vector<std::string>& args); - void SetCurrentSourceDirectory(const std::string& dir); const char* GetCurrentSourceDirectory() const; - void SetCurrentBinaryDirectory(const std::string& dir); const char* GetCurrentBinaryDirectory() const; //@} diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index b278087..cd499f6 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1149,7 +1149,7 @@ cmMakefileTargetGenerator { // Depend on all custom command outputs. std::vector<cmSourceFile*> sources; - this->Target->GetSourceFiles(sources, + this->GeneratorTarget->GetSourceFiles(sources, this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for(std::vector<cmSourceFile*>::const_iterator source = sources.begin(); source != sources.end(); ++source) diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 84c19a3..24fcaf4 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -112,7 +112,7 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules() // Write rules for languages compiled in this target. std::set<std::string> languages; std::vector<cmSourceFile*> sourceFiles; - this->GetTarget()->GetSourceFiles(sourceFiles, + this->GetGeneratorTarget()->GetSourceFiles(sourceFiles, this->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE")); for(std::vector<cmSourceFile*>::const_iterator i = sourceFiles.begin(); i != sourceFiles.end(); ++i) diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index 58b901a..df43c61 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -58,7 +58,7 @@ void cmNinjaUtilityTargetGenerator::Generate() std::vector<cmSourceFile*> sources; std::string config = this->GetMakefile() ->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->GetTarget()->GetSourceFiles(sources, config); + this->GetGeneratorTarget()->GetSourceFiles(sources, config); for(std::vector<cmSourceFile*>::const_iterator source = sources.begin(); source != sources.end(); ++source) { diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 24e7ed8..378f132 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -25,22 +25,421 @@ # include "cmGlobalVisualStudioGenerator.h" #endif -std::string cmQtAutoGeneratorInitializer::GetAutogenTargetName( - cmTarget const* target) +static void SetupSourceFiles(cmGeneratorTarget const* target, + std::vector<std::string>& skipMoc, + std::vector<std::string>& mocSources, + std::vector<std::string>& mocHeaders, + std::vector<std::string>& skipUic) +{ + cmMakefile* makefile = target->Target->GetMakefile(); + + std::vector<cmSourceFile*> srcFiles; + target->GetConfigCommonSourceFiles(srcFiles); + + std::vector<std::string> newRccFiles; + + for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin(); + fileIt != srcFiles.end(); + ++fileIt) + { + cmSourceFile* sf = *fileIt; + std::string absFile = cmsys::SystemTools::GetRealPath( + sf->GetFullPath()); + bool skipFileForMoc = + cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC")); + bool generated = cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED")); + + if(cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOUIC"))) + { + skipUic.push_back(absFile); + } + + std::string ext = sf->GetExtension(); + + if (target->GetPropertyAsBool("AUTORCC")) + { + if (ext == "qrc" + && !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) + { + std::string basename = cmsys::SystemTools:: + GetFilenameWithoutLastExtension(absFile); + + std::string rcc_output_dir = target->Target->GetSupportDirectory(); + cmSystemTools::MakeDirectory(rcc_output_dir.c_str()); + std::string rcc_output_file = rcc_output_dir; + rcc_output_file += "/qrc_" + basename + ".cpp"; + makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", + rcc_output_file.c_str(), false); + makefile->GetOrCreateSource(rcc_output_file, true); + newRccFiles.push_back(rcc_output_file); + } + } + + if (!generated) + { + if (skipFileForMoc) + { + skipMoc.push_back(absFile); + } + else + { + cmSystemTools::FileFormat fileType = cmSystemTools::GetFileFormat( + ext.c_str()); + if (fileType == cmSystemTools::CXX_FILE_FORMAT) + { + mocSources.push_back(absFile); + } + else if (fileType == cmSystemTools::HEADER_FILE_FORMAT) + { + mocHeaders.push_back(absFile); + } + } + } + } + + for(std::vector<std::string>::const_iterator fileIt = newRccFiles.begin(); + fileIt != newRccFiles.end(); + ++fileIt) + { + const_cast<cmGeneratorTarget*>(target)->AddSource(*fileIt); + } +} + +static void GetCompileDefinitionsAndDirectories( + cmGeneratorTarget const* target, + const std::string& config, + std::string &incs, + std::string &defs) +{ + std::vector<std::string> includeDirs; + cmLocalGenerator *localGen = target->GetLocalGenerator(); + // Get the include dirs for this target, without stripping the implicit + // include dirs off, see http://public.kitware.com/Bug/view.php?id=13667 + localGen->GetIncludeDirectories(includeDirs, target, "CXX", config, false); + + incs = cmJoin(includeDirs, ";"); + + std::set<std::string> defines; + localGen->AddCompileDefinitions(defines, target->Target, config, "CXX"); + + defs += cmJoin(defines, ";"); +} + +static void SetupAutoMocTarget(cmGeneratorTarget const* target, + const std::string &autogenTargetName, + std::vector<std::string> const& skipMoc, + std::vector<std::string> const& mocHeaders, + std::map<std::string, std::string> &configIncludes, + std::map<std::string, std::string> &configDefines) +{ + cmMakefile* makefile = target->Target->GetMakefile(); + + const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS"); + std::string _moc_options = (tmp!=0 ? tmp : ""); + makefile->AddDefinition("_moc_options", + cmOutputConverter::EscapeForCMake(_moc_options).c_str()); + makefile->AddDefinition("_skip_moc", + cmOutputConverter::EscapeForCMake(cmJoin(skipMoc, ";")).c_str()); + makefile->AddDefinition("_moc_headers", + cmOutputConverter::EscapeForCMake(cmJoin(mocHeaders, ";")).c_str()); + bool relaxedMode = makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE"); + makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE"); + + std::string _moc_incs; + std::string _moc_compile_defs; + std::vector<std::string> configs; + const std::string& config = makefile->GetConfigurations(configs); + GetCompileDefinitionsAndDirectories(target, config, + _moc_incs, _moc_compile_defs); + + makefile->AddDefinition("_moc_incs", + cmOutputConverter::EscapeForCMake(_moc_incs).c_str()); + makefile->AddDefinition("_moc_compile_defs", + cmOutputConverter::EscapeForCMake(_moc_compile_defs).c_str()); + + for (std::vector<std::string>::const_iterator li = configs.begin(); + li != configs.end(); ++li) + { + std::string config_moc_incs; + std::string config_moc_compile_defs; + GetCompileDefinitionsAndDirectories(target, *li, + config_moc_incs, + config_moc_compile_defs); + if (config_moc_incs != _moc_incs) + { + configIncludes[*li] = + cmOutputConverter::EscapeForCMake(config_moc_incs); + if(_moc_incs.empty()) + { + _moc_incs = config_moc_incs; + } + } + if (config_moc_compile_defs != _moc_compile_defs) + { + configDefines[*li] = + cmOutputConverter::EscapeForCMake(config_moc_compile_defs); + if(_moc_compile_defs.empty()) + { + _moc_compile_defs = config_moc_compile_defs; + } + } + } + + const char *qtVersion = makefile->GetDefinition("_target_qt_version"); + if (strcmp(qtVersion, "5") == 0) + { + cmTarget *qt5Moc = makefile->FindTargetToUse("Qt5::moc"); + if (!qt5Moc) + { + cmSystemTools::Error("Qt5::moc target not found ", + autogenTargetName.c_str()); + return; + } + makefile->AddDefinition("_qt_moc_executable", + qt5Moc->ImportedGetLocation("")); + } + else if (strcmp(qtVersion, "4") == 0) + { + cmTarget *qt4Moc = makefile->FindTargetToUse("Qt4::moc"); + if (!qt4Moc) + { + cmSystemTools::Error("Qt4::moc target not found ", + autogenTargetName.c_str()); + return; + } + makefile->AddDefinition("_qt_moc_executable", + qt4Moc->ImportedGetLocation("")); + } + else + { + cmSystemTools::Error("The CMAKE_AUTOMOC feature supports only Qt 4 and " + "Qt 5 ", autogenTargetName.c_str()); + } +} + +static void GetUicOpts(cmGeneratorTarget const* target, + const std::string& config, + std::string &optString) +{ + std::vector<std::string> opts; + target->GetAutoUicOptions(opts, config); + optString = cmJoin(opts, ";"); +} + +static void SetupAutoUicTarget(cmGeneratorTarget const* target, + std::vector<std::string> const& skipUic, + std::map<std::string, std::string> &configUicOptions) +{ + cmMakefile *makefile = target->Target->GetMakefile(); + + std::set<std::string> skipped; + skipped.insert(skipUic.begin(), skipUic.end()); + + makefile->AddDefinition("_skip_uic", + cmOutputConverter::EscapeForCMake(cmJoin(skipUic, ";")).c_str()); + + std::vector<cmSourceFile*> uiFilesWithOptions + = makefile->GetQtUiFilesWithOptions(); + + const char *qtVersion = makefile->GetDefinition("_target_qt_version"); + + std::string _uic_opts; + std::vector<std::string> configs; + const std::string& config = makefile->GetConfigurations(configs); + GetUicOpts(target, config, _uic_opts); + + if (!_uic_opts.empty()) + { + _uic_opts = cmOutputConverter::EscapeForCMake(_uic_opts); + makefile->AddDefinition("_uic_target_options", _uic_opts.c_str()); + } + for (std::vector<std::string>::const_iterator li = configs.begin(); + li != configs.end(); ++li) + { + std::string config_uic_opts; + GetUicOpts(target, *li, config_uic_opts); + if (config_uic_opts != _uic_opts) + { + configUicOptions[*li] = + cmOutputConverter::EscapeForCMake(config_uic_opts); + if(_uic_opts.empty()) + { + _uic_opts = config_uic_opts; + } + } + } + + std::string uiFileFiles; + std::string uiFileOptions; + const char* sep = ""; + + for(std::vector<cmSourceFile*>::const_iterator fileIt = + uiFilesWithOptions.begin(); + fileIt != uiFilesWithOptions.end(); + ++fileIt) + { + cmSourceFile* sf = *fileIt; + std::string absFile = cmsys::SystemTools::GetRealPath( + sf->GetFullPath()); + + if (!skipped.insert(absFile).second) + { + continue; + } + uiFileFiles += sep; + uiFileFiles += absFile; + uiFileOptions += sep; + std::string opts = sf->GetProperty("AUTOUIC_OPTIONS"); + cmSystemTools::ReplaceString(opts, ";", "@list_sep@"); + uiFileOptions += opts; + sep = ";"; + } + + makefile->AddDefinition("_qt_uic_options_files", + cmOutputConverter::EscapeForCMake(uiFileFiles).c_str()); + makefile->AddDefinition("_qt_uic_options_options", + cmOutputConverter::EscapeForCMake(uiFileOptions).c_str()); + + std::string targetName = target->GetName(); + if (strcmp(qtVersion, "5") == 0) + { + cmTarget *qt5Uic = makefile->FindTargetToUse("Qt5::uic"); + if (!qt5Uic) + { + // Project does not use Qt5Widgets, but has AUTOUIC ON anyway + } + else + { + makefile->AddDefinition("_qt_uic_executable", + qt5Uic->ImportedGetLocation("")); + } + } + else if (strcmp(qtVersion, "4") == 0) + { + cmTarget *qt4Uic = makefile->FindTargetToUse("Qt4::uic"); + if (!qt4Uic) + { + cmSystemTools::Error("Qt4::uic target not found ", + targetName.c_str()); + return; + } + makefile->AddDefinition("_qt_uic_executable", + qt4Uic->ImportedGetLocation("")); + } + else + { + cmSystemTools::Error("The CMAKE_AUTOUIC feature supports only Qt 4 and " + "Qt 5 ", targetName.c_str()); + } +} + +static std::string GetRccExecutable(cmGeneratorTarget const* target) +{ + cmMakefile *makefile = target->Target->GetMakefile(); + const char *qtVersion = makefile->GetDefinition("_target_qt_version"); + if (!qtVersion) + { + qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR"); + if (!qtVersion) + { + qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR"); + } + if (const char *targetQtVersion = + target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", + "")) + { + qtVersion = targetQtVersion; + } + } + + std::string targetName = target->GetName(); + if (strcmp(qtVersion, "5") == 0) + { + cmTarget *qt5Rcc = makefile->FindTargetToUse("Qt5::rcc"); + if (!qt5Rcc) + { + cmSystemTools::Error("Qt5::rcc target not found ", + targetName.c_str()); + return std::string(); + } + return qt5Rcc->ImportedGetLocation(""); + } + else if (strcmp(qtVersion, "4") == 0) + { + cmTarget *qt4Rcc = makefile->FindTargetToUse("Qt4::rcc"); + if (!qt4Rcc) + { + cmSystemTools::Error("Qt4::rcc target not found ", + targetName.c_str()); + return std::string(); + } + return qt4Rcc->ImportedGetLocation(""); + } + + cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and " + "Qt 5 ", targetName.c_str()); + return std::string(); +} + +static void MergeRccOptions(std::vector<std::string> &opts, + const std::vector<std::string> &fileOpts, + bool isQt5) +{ + static const char* valueOptions[] = { + "name", + "root", + "compress", + "threshold" + }; + std::vector<std::string> extraOpts; + for(std::vector<std::string>::const_iterator it = fileOpts.begin(); + it != fileOpts.end(); ++it) + { + std::vector<std::string>::iterator existingIt + = std::find(opts.begin(), opts.end(), *it); + if (existingIt != opts.end()) + { + const char *o = it->c_str(); + if (*o == '-') + { + ++o; + } + if (isQt5 && *o == '-') + { + ++o; + } + if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions), + cmStrCmp(*it)) != cmArrayEnd(valueOptions)) + { + assert(existingIt + 1 != opts.end()); + *(existingIt + 1) = *(it + 1); + ++it; + } + } + else + { + extraOpts.push_back(*it); + } + } + opts.insert(opts.end(), extraOpts.begin(), extraOpts.end()); +} + +std::string GetAutogenTargetName( + cmGeneratorTarget const* target) { std::string autogenTargetName = target->GetName(); autogenTargetName += "_automoc"; return autogenTargetName; } -std::string cmQtAutoGeneratorInitializer::GetAutogenTargetDir( - cmTarget const* target) +std::string GetAutogenTargetDir( + cmGeneratorTarget const* target) { - cmMakefile* makefile = target->GetMakefile(); + cmMakefile* makefile = target->Target->GetMakefile(); std::string targetDir = makefile->GetCurrentBinaryDirectory(); targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory(); targetDir += "/"; - targetDir += cmQtAutoGeneratorInitializer::GetAutogenTargetName(target); + targetDir += GetAutogenTargetName(target); targetDir += ".dir/"; return targetDir; } @@ -76,12 +475,12 @@ static std::string ReadAll(const std::string& filename) return stream.str(); } -std::string cmQtAutoGeneratorInitializer::ListQt5RccInputs(cmSourceFile* sf, - cmTarget const* target, +static std::string ListQt5RccInputs(cmSourceFile* sf, + cmGeneratorTarget const* target, std::vector<std::string>& depends) { std::string rccCommand - = cmQtAutoGeneratorInitializer::GetRccExecutable(target); + = GetRccExecutable(target); std::vector<std::string> qrcEntries; std::vector<std::string> command; @@ -147,7 +546,7 @@ std::string cmQtAutoGeneratorInitializer::ListQt5RccInputs(cmSourceFile* sf, return cmJoin(qrcEntries, "@list_sep@"); } -std::string cmQtAutoGeneratorInitializer::ListQt4RccInputs(cmSourceFile* sf, +static std::string ListQt4RccInputs(cmSourceFile* sf, std::vector<std::string>& depends) { const std::string qrcContents = ReadAll(sf->GetFullPath()); @@ -183,15 +582,125 @@ std::string cmQtAutoGeneratorInitializer::ListQt4RccInputs(cmSourceFile* sf, return entriesList; } +static void SetupAutoRccTarget(cmGeneratorTarget const* target) +{ + std::string _rcc_files; + const char* sepRccFiles = ""; + cmMakefile *makefile = target->Target->GetMakefile(); + + std::vector<cmSourceFile*> srcFiles; + target->GetConfigCommonSourceFiles(srcFiles); + + std::string qrcInputs; + const char* qrcInputsSep = ""; + + std::string rccFileFiles; + std::string rccFileOptions; + const char *optionSep = ""; + + const char *qtVersion = makefile->GetDefinition("_target_qt_version"); + + std::vector<std::string> rccOptions; + if (const char* opts = target->GetProperty("AUTORCC_OPTIONS")) + { + cmSystemTools::ExpandListArgument(opts, rccOptions); + } + std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR"); + if (qtMajorVersion == "") + { + qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR"); + } + + for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin(); + fileIt != srcFiles.end(); + ++fileIt) + { + cmSourceFile* sf = *fileIt; + std::string ext = sf->GetExtension(); + if (ext == "qrc") + { + std::string absFile = cmsys::SystemTools::GetRealPath( + sf->GetFullPath()); + bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC")); -void cmQtAutoGeneratorInitializer::InitializeAutogenSources(cmTarget* target) + if (!skip) + { + _rcc_files += sepRccFiles; + _rcc_files += absFile; + sepRccFiles = ";"; + + if (const char *prop = sf->GetProperty("AUTORCC_OPTIONS")) + { + std::vector<std::string> optsVec; + cmSystemTools::ExpandListArgument(prop, optsVec); + MergeRccOptions(rccOptions, optsVec, + strcmp(qtVersion, "5") == 0); + } + + if (!rccOptions.empty()) + { + rccFileFiles += optionSep; + rccFileFiles += absFile; + rccFileOptions += optionSep; + } + const char *listSep = ""; + for(std::vector<std::string>::const_iterator it = rccOptions.begin(); + it != rccOptions.end(); + ++it) + { + rccFileOptions += listSep; + rccFileOptions += *it; + listSep = "@list_sep@"; + } + optionSep = ";"; + + std::vector<std::string> depends; + + std::string entriesList; + if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) + { + if (qtMajorVersion == "5") + { + entriesList = ListQt5RccInputs(sf, target, depends); + } + else + { + entriesList = ListQt4RccInputs(sf, depends); + } + if (entriesList.empty()) + { + return; + } + } + qrcInputs += qrcInputsSep; + qrcInputs += entriesList; + qrcInputsSep = ";"; + } + } + } + makefile->AddDefinition("_qt_rcc_inputs_" + target->GetName(), + cmOutputConverter::EscapeForCMake(qrcInputs).c_str()); + + makefile->AddDefinition("_rcc_files", + cmOutputConverter::EscapeForCMake(_rcc_files).c_str()); + + makefile->AddDefinition("_qt_rcc_options_files", + cmOutputConverter::EscapeForCMake(rccFileFiles).c_str()); + makefile->AddDefinition("_qt_rcc_options_options", + cmOutputConverter::EscapeForCMake(rccFileOptions).c_str()); + + makefile->AddDefinition("_qt_rcc_executable", + GetRccExecutable(target).c_str()); +} + +void cmQtAutoGeneratorInitializer::InitializeAutogenSources( + cmGeneratorTarget* target) { - cmMakefile* makefile = target->GetMakefile(); + cmMakefile* makefile = target->Target->GetMakefile(); if (target->GetPropertyAsBool("AUTOMOC")) { - std::string automocTargetName = - cmQtAutoGeneratorInitializer::GetAutogenTargetName(target); + std::string automocTargetName = GetAutogenTargetName(target); std::string mocCppFile = makefile->GetCurrentBinaryDirectory(); mocCppFile += "/"; mocCppFile += automocTargetName; @@ -206,9 +715,9 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenSources(cmTarget* target) void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( cmLocalGenerator* lg, - cmTarget* target) + cmGeneratorTarget* target) { - cmMakefile* makefile = target->GetMakefile(); + cmMakefile* makefile = target->Target->GetMakefile(); std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR"); if (qtMajorVersion == "") @@ -217,11 +726,9 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( } // create a custom target for running generators at buildtime: - std::string autogenTargetName = - cmQtAutoGeneratorInitializer::GetAutogenTargetName(target); + std::string autogenTargetName = GetAutogenTargetName(target); - std::string targetDir = - cmQtAutoGeneratorInitializer::GetAutogenTargetDir(target); + std::string targetDir = GetAutogenTargetDir(target); cmCustomCommandLine currentLine; currentLine.push_back(cmSystemTools::GetCMakeCommand()); @@ -307,9 +814,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( ) { std::vector<cmSourceFile*> srcFiles; - cmGeneratorTarget* gtgt = - lg->GetGlobalGenerator()->GetGeneratorTarget(target); - gtgt->GetConfigCommonSourceFiles(srcFiles); + target->GetConfigCommonSourceFiles(srcFiles); for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin(); fileIt != srcFiles.end(); ++fileIt) @@ -328,7 +833,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( std::string basename = cmsys::SystemTools:: GetFilenameWithoutLastExtension(absFile); - std::string rcc_output_dir = target->GetSupportDirectory(); + std::string rcc_output_dir = target->Target->GetSupportDirectory(); cmSystemTools::MakeDirectory(rcc_output_dir.c_str()); std::string rcc_output_file = rcc_output_dir; rcc_output_file += "/qrc_" + basename + ".cpp"; @@ -338,12 +843,11 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( { if (qtMajorVersion == "5") { - cmQtAutoGeneratorInitializer::ListQt5RccInputs(sf, target, - depends); + ListQt5RccInputs(sf, target, depends); } else { - cmQtAutoGeneratorInitializer::ListQt4RccInputs(sf, depends); + ListQt4RccInputs(sf, depends); } #if defined(_WIN32) && !defined(__CYGWIN__) // Cannot use PRE_BUILD because the resource files themselves @@ -370,7 +874,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( workingDirectory.c_str()); cc.SetEscapeOldStyle(false); cc.SetEscapeAllowMakeVars(true); - target->AddPreBuildCommand(cc); + target->Target->AddPreBuildCommand(cc); } else #endif @@ -399,66 +903,39 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( else { // inherit FOLDER property from target (#13688) - copyTargetProperty(autogenTarget, target, "FOLDER"); + copyTargetProperty(gt->Target, target->Target, "FOLDER"); } - target->AddUtility(autogenTargetName); + target->Target->AddUtility(autogenTargetName); } } -static void GetCompileDefinitionsAndDirectories(cmTarget const* target, - const std::string& config, - std::string &incs, - std::string &defs) -{ - cmMakefile* makefile = target->GetMakefile(); - cmGlobalGenerator* globalGen = makefile->GetGlobalGenerator(); - std::vector<std::string> includeDirs; - cmGeneratorTarget *gtgt = globalGen->GetGeneratorTarget(target); - cmLocalGenerator *localGen = gtgt->GetLocalGenerator(); - // Get the include dirs for this target, without stripping the implicit - // include dirs off, see http://public.kitware.com/Bug/view.php?id=13667 - localGen->GetIncludeDirectories(includeDirs, gtgt, "CXX", config, false); - - incs = cmJoin(includeDirs, ";"); - - std::set<std::string> defines; - localGen->AddCompileDefinitions(defines, target, config, "CXX"); - - defs += cmJoin(defines, ";"); -} - void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget( - cmTarget const* target) + cmGeneratorTarget const* target) { - cmMakefile* makefile = target->GetMakefile(); + cmMakefile* makefile = target->Target->GetMakefile(); // forget the variables added here afterwards again: cmMakefile::ScopePushPop varScope(makefile); static_cast<void>(varScope); // create a custom target for running generators at buildtime: - std::string autogenTargetName = - cmQtAutoGeneratorInitializer::GetAutogenTargetName(target); + std::string autogenTargetName = GetAutogenTargetName(target); makefile->AddDefinition("_moc_target_name", cmOutputConverter::EscapeForCMake(autogenTargetName).c_str()); makefile->AddDefinition("_origin_target_name", cmOutputConverter::EscapeForCMake(target->GetName()).c_str()); - std::string targetDir = - cmQtAutoGeneratorInitializer::GetAutogenTargetDir(target); + std::string targetDir = GetAutogenTargetDir(target); const char *qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR"); if (!qtVersion) { qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR"); } - cmGeneratorTarget *gtgt = target->GetMakefile() - ->GetGlobalGenerator() - ->GetGeneratorTarget(target); if (const char *targetQtVersion = - gtgt->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", "")) + target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", "")) { qtVersion = targetQtVersion; } @@ -479,25 +956,23 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget( || target->GetPropertyAsBool("AUTOUIC") || target->GetPropertyAsBool("AUTORCC")) { - cmQtAutoGeneratorInitializer::SetupSourceFiles(target, skipMoc, - mocSources, mocHeaders, skipUic); + SetupSourceFiles(target, skipMoc, mocSources, mocHeaders, skipUic); } makefile->AddDefinition("_cpp_files", cmOutputConverter::EscapeForCMake(cmJoin(mocSources, ";")).c_str()); if (target->GetPropertyAsBool("AUTOMOC")) { - cmQtAutoGeneratorInitializer::SetupAutoMocTarget(target, autogenTargetName, + SetupAutoMocTarget(target, autogenTargetName, skipMoc, mocHeaders, configIncludes, configDefines); } if (target->GetPropertyAsBool("AUTOUIC")) { - cmQtAutoGeneratorInitializer::SetupAutoUicTarget(target, skipUic, - configUicOptions); + SetupAutoUicTarget(target, skipUic, configUicOptions); } if (target->GetPropertyAsBool("AUTORCC")) { - cmQtAutoGeneratorInitializer::SetupAutoRccTarget(target); + SetupAutoRccTarget(target); } const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT"); @@ -567,508 +1042,3 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget( } } } - -void cmQtAutoGeneratorInitializer::SetupSourceFiles(cmTarget const* target, - std::vector<std::string>& skipMoc, - std::vector<std::string>& mocSources, - std::vector<std::string>& mocHeaders, - std::vector<std::string>& skipUic) -{ - cmMakefile* makefile = target->GetMakefile(); - - std::vector<cmSourceFile*> srcFiles; - cmGeneratorTarget *gtgt = target->GetMakefile() - ->GetGlobalGenerator() - ->GetGeneratorTarget(target); - gtgt->GetConfigCommonSourceFiles(srcFiles); - - std::vector<std::string> newRccFiles; - - for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin(); - fileIt != srcFiles.end(); - ++fileIt) - { - cmSourceFile* sf = *fileIt; - std::string absFile = cmsys::SystemTools::GetRealPath( - sf->GetFullPath()); - bool skipFileForMoc = - cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC")); - bool generated = cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED")); - - if(cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOUIC"))) - { - skipUic.push_back(absFile); - } - - std::string ext = sf->GetExtension(); - - if (target->GetPropertyAsBool("AUTORCC")) - { - if (ext == "qrc" - && !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) - { - std::string basename = cmsys::SystemTools:: - GetFilenameWithoutLastExtension(absFile); - - std::string rcc_output_dir = target->GetSupportDirectory(); - cmSystemTools::MakeDirectory(rcc_output_dir.c_str()); - std::string rcc_output_file = rcc_output_dir; - rcc_output_file += "/qrc_" + basename + ".cpp"; - makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", - rcc_output_file.c_str(), false); - makefile->GetOrCreateSource(rcc_output_file, true); - newRccFiles.push_back(rcc_output_file); - } - } - - if (!generated) - { - if (skipFileForMoc) - { - skipMoc.push_back(absFile); - } - else - { - cmSystemTools::FileFormat fileType = cmSystemTools::GetFileFormat( - ext.c_str()); - if (fileType == cmSystemTools::CXX_FILE_FORMAT) - { - mocSources.push_back(absFile); - } - else if (fileType == cmSystemTools::HEADER_FILE_FORMAT) - { - mocHeaders.push_back(absFile); - } - } - } - } - - for(std::vector<std::string>::const_iterator fileIt = newRccFiles.begin(); - fileIt != newRccFiles.end(); - ++fileIt) - { - const_cast<cmTarget*>(target)->AddSource(*fileIt); - } -} - -void cmQtAutoGeneratorInitializer::SetupAutoMocTarget(cmTarget const* target, - const std::string &autogenTargetName, - std::vector<std::string> const& skipMoc, - std::vector<std::string> const& mocHeaders, - std::map<std::string, std::string> &configIncludes, - std::map<std::string, std::string> &configDefines) -{ - cmMakefile* makefile = target->GetMakefile(); - - const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS"); - std::string _moc_options = (tmp!=0 ? tmp : ""); - makefile->AddDefinition("_moc_options", - cmOutputConverter::EscapeForCMake(_moc_options).c_str()); - makefile->AddDefinition("_skip_moc", - cmOutputConverter::EscapeForCMake(cmJoin(skipMoc, ";")).c_str()); - makefile->AddDefinition("_moc_headers", - cmOutputConverter::EscapeForCMake(cmJoin(mocHeaders, ";")).c_str()); - bool relaxedMode = makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE"); - makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE"); - - std::string _moc_incs; - std::string _moc_compile_defs; - std::vector<std::string> configs; - const std::string& config = makefile->GetConfigurations(configs); - GetCompileDefinitionsAndDirectories(target, config, - _moc_incs, _moc_compile_defs); - - makefile->AddDefinition("_moc_incs", - cmOutputConverter::EscapeForCMake(_moc_incs).c_str()); - makefile->AddDefinition("_moc_compile_defs", - cmOutputConverter::EscapeForCMake(_moc_compile_defs).c_str()); - - for (std::vector<std::string>::const_iterator li = configs.begin(); - li != configs.end(); ++li) - { - std::string config_moc_incs; - std::string config_moc_compile_defs; - GetCompileDefinitionsAndDirectories(target, *li, - config_moc_incs, - config_moc_compile_defs); - if (config_moc_incs != _moc_incs) - { - configIncludes[*li] = - cmOutputConverter::EscapeForCMake(config_moc_incs); - if(_moc_incs.empty()) - { - _moc_incs = config_moc_incs; - } - } - if (config_moc_compile_defs != _moc_compile_defs) - { - configDefines[*li] = - cmOutputConverter::EscapeForCMake(config_moc_compile_defs); - if(_moc_compile_defs.empty()) - { - _moc_compile_defs = config_moc_compile_defs; - } - } - } - - const char *qtVersion = makefile->GetDefinition("_target_qt_version"); - if (strcmp(qtVersion, "5") == 0) - { - cmTarget *qt5Moc = makefile->FindTargetToUse("Qt5::moc"); - if (!qt5Moc) - { - cmSystemTools::Error("Qt5::moc target not found ", - autogenTargetName.c_str()); - return; - } - makefile->AddDefinition("_qt_moc_executable", - qt5Moc->ImportedGetLocation("")); - } - else if (strcmp(qtVersion, "4") == 0) - { - cmTarget *qt4Moc = makefile->FindTargetToUse("Qt4::moc"); - if (!qt4Moc) - { - cmSystemTools::Error("Qt4::moc target not found ", - autogenTargetName.c_str()); - return; - } - makefile->AddDefinition("_qt_moc_executable", - qt4Moc->ImportedGetLocation("")); - } - else - { - cmSystemTools::Error("The CMAKE_AUTOMOC feature supports only Qt 4 and " - "Qt 5 ", autogenTargetName.c_str()); - } -} - -static void GetUicOpts(cmTarget const* target, const std::string& config, - std::string &optString) -{ - cmGeneratorTarget *gtgt = target->GetMakefile() - ->GetGlobalGenerator() - ->GetGeneratorTarget(target); - std::vector<std::string> opts; - gtgt->GetAutoUicOptions(opts, config); - optString = cmJoin(opts, ";"); -} - -void cmQtAutoGeneratorInitializer::SetupAutoUicTarget(cmTarget const* target, - std::vector<std::string> const& skipUic, - std::map<std::string, std::string> &configUicOptions) -{ - cmMakefile *makefile = target->GetMakefile(); - - std::set<std::string> skipped; - skipped.insert(skipUic.begin(), skipUic.end()); - - makefile->AddDefinition("_skip_uic", - cmOutputConverter::EscapeForCMake(cmJoin(skipUic, ";")).c_str()); - - std::vector<cmSourceFile*> uiFilesWithOptions - = makefile->GetQtUiFilesWithOptions(); - - const char *qtVersion = makefile->GetDefinition("_target_qt_version"); - - std::string _uic_opts; - std::vector<std::string> configs; - const std::string& config = makefile->GetConfigurations(configs); - GetUicOpts(target, config, _uic_opts); - - if (!_uic_opts.empty()) - { - _uic_opts = cmOutputConverter::EscapeForCMake(_uic_opts); - makefile->AddDefinition("_uic_target_options", _uic_opts.c_str()); - } - for (std::vector<std::string>::const_iterator li = configs.begin(); - li != configs.end(); ++li) - { - std::string config_uic_opts; - GetUicOpts(target, *li, config_uic_opts); - if (config_uic_opts != _uic_opts) - { - configUicOptions[*li] = - cmOutputConverter::EscapeForCMake(config_uic_opts); - if(_uic_opts.empty()) - { - _uic_opts = config_uic_opts; - } - } - } - - std::string uiFileFiles; - std::string uiFileOptions; - const char* sep = ""; - - for(std::vector<cmSourceFile*>::const_iterator fileIt = - uiFilesWithOptions.begin(); - fileIt != uiFilesWithOptions.end(); - ++fileIt) - { - cmSourceFile* sf = *fileIt; - std::string absFile = cmsys::SystemTools::GetRealPath( - sf->GetFullPath()); - - if (!skipped.insert(absFile).second) - { - continue; - } - uiFileFiles += sep; - uiFileFiles += absFile; - uiFileOptions += sep; - std::string opts = sf->GetProperty("AUTOUIC_OPTIONS"); - cmSystemTools::ReplaceString(opts, ";", "@list_sep@"); - uiFileOptions += opts; - sep = ";"; - } - - makefile->AddDefinition("_qt_uic_options_files", - cmOutputConverter::EscapeForCMake(uiFileFiles).c_str()); - makefile->AddDefinition("_qt_uic_options_options", - cmOutputConverter::EscapeForCMake(uiFileOptions).c_str()); - - std::string targetName = target->GetName(); - if (strcmp(qtVersion, "5") == 0) - { - cmTarget *qt5Uic = makefile->FindTargetToUse("Qt5::uic"); - if (!qt5Uic) - { - // Project does not use Qt5Widgets, but has AUTOUIC ON anyway - } - else - { - makefile->AddDefinition("_qt_uic_executable", - qt5Uic->ImportedGetLocation("")); - } - } - else if (strcmp(qtVersion, "4") == 0) - { - cmTarget *qt4Uic = makefile->FindTargetToUse("Qt4::uic"); - if (!qt4Uic) - { - cmSystemTools::Error("Qt4::uic target not found ", - targetName.c_str()); - return; - } - makefile->AddDefinition("_qt_uic_executable", - qt4Uic->ImportedGetLocation("")); - } - else - { - cmSystemTools::Error("The CMAKE_AUTOUIC feature supports only Qt 4 and " - "Qt 5 ", targetName.c_str()); - } -} - -void cmQtAutoGeneratorInitializer::MergeRccOptions( - std::vector<std::string> &opts, - const std::vector<std::string> &fileOpts, - bool isQt5) -{ - static const char* valueOptions[] = { - "name", - "root", - "compress", - "threshold" - }; - std::vector<std::string> extraOpts; - for(std::vector<std::string>::const_iterator it = fileOpts.begin(); - it != fileOpts.end(); ++it) - { - std::vector<std::string>::iterator existingIt - = std::find(opts.begin(), opts.end(), *it); - if (existingIt != opts.end()) - { - const char *o = it->c_str(); - if (*o == '-') - { - ++o; - } - if (isQt5 && *o == '-') - { - ++o; - } - if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions), - cmStrCmp(*it)) != cmArrayEnd(valueOptions)) - { - assert(existingIt + 1 != opts.end()); - *(existingIt + 1) = *(it + 1); - ++it; - } - } - else - { - extraOpts.push_back(*it); - } - } - opts.insert(opts.end(), extraOpts.begin(), extraOpts.end()); -} - -void cmQtAutoGeneratorInitializer::SetupAutoRccTarget(cmTarget const* target) -{ - std::string _rcc_files; - const char* sepRccFiles = ""; - cmMakefile *makefile = target->GetMakefile(); - - std::vector<cmSourceFile*> srcFiles; - cmGeneratorTarget *gtgt = target->GetMakefile() - ->GetGlobalGenerator() - ->GetGeneratorTarget(target); - gtgt->GetConfigCommonSourceFiles(srcFiles); - - std::string qrcInputs; - const char* qrcInputsSep = ""; - - std::string rccFileFiles; - std::string rccFileOptions; - const char *optionSep = ""; - - const char *qtVersion = makefile->GetDefinition("_target_qt_version"); - - std::vector<std::string> rccOptions; - if (const char* opts = target->GetProperty("AUTORCC_OPTIONS")) - { - cmSystemTools::ExpandListArgument(opts, rccOptions); - } - std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR"); - if (qtMajorVersion == "") - { - qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR"); - } - - for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin(); - fileIt != srcFiles.end(); - ++fileIt) - { - cmSourceFile* sf = *fileIt; - std::string ext = sf->GetExtension(); - if (ext == "qrc") - { - std::string absFile = cmsys::SystemTools::GetRealPath( - sf->GetFullPath()); - bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC")); - - if (!skip) - { - _rcc_files += sepRccFiles; - _rcc_files += absFile; - sepRccFiles = ";"; - - if (const char *prop = sf->GetProperty("AUTORCC_OPTIONS")) - { - std::vector<std::string> optsVec; - cmSystemTools::ExpandListArgument(prop, optsVec); - cmQtAutoGeneratorInitializer::MergeRccOptions(rccOptions, optsVec, - strcmp(qtVersion, "5") == 0); - } - - if (!rccOptions.empty()) - { - rccFileFiles += optionSep; - rccFileFiles += absFile; - rccFileOptions += optionSep; - } - const char *listSep = ""; - for(std::vector<std::string>::const_iterator it = rccOptions.begin(); - it != rccOptions.end(); - ++it) - { - rccFileOptions += listSep; - rccFileOptions += *it; - listSep = "@list_sep@"; - } - optionSep = ";"; - - std::vector<std::string> depends; - - std::string entriesList; - if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) - { - if (qtMajorVersion == "5") - { - entriesList = cmQtAutoGeneratorInitializer::ListQt5RccInputs(sf, - target, - depends); - } - else - { - entriesList = - cmQtAutoGeneratorInitializer::ListQt4RccInputs(sf, depends); - } - if (entriesList.empty()) - { - return; - } - } - qrcInputs += qrcInputsSep; - qrcInputs += entriesList; - qrcInputsSep = ";"; - } - } - } - makefile->AddDefinition("_qt_rcc_inputs_" + target->GetName(), - cmOutputConverter::EscapeForCMake(qrcInputs).c_str()); - - makefile->AddDefinition("_rcc_files", - cmOutputConverter::EscapeForCMake(_rcc_files).c_str()); - - makefile->AddDefinition("_qt_rcc_options_files", - cmOutputConverter::EscapeForCMake(rccFileFiles).c_str()); - makefile->AddDefinition("_qt_rcc_options_options", - cmOutputConverter::EscapeForCMake(rccFileOptions).c_str()); - - makefile->AddDefinition("_qt_rcc_executable", - cmQtAutoGeneratorInitializer::GetRccExecutable(target).c_str()); -} - -std::string cmQtAutoGeneratorInitializer::GetRccExecutable( - cmTarget const* target) -{ - cmGeneratorTarget *gtgt = target->GetMakefile() - ->GetGlobalGenerator() - ->GetGeneratorTarget(target); - cmMakefile *makefile = target->GetMakefile(); - const char *qtVersion = makefile->GetDefinition("_target_qt_version"); - if (!qtVersion) - { - qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR"); - if (!qtVersion) - { - qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR"); - } - if (const char *targetQtVersion = - gtgt->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", "")) - { - qtVersion = targetQtVersion; - } - } - - std::string targetName = target->GetName(); - if (strcmp(qtVersion, "5") == 0) - { - cmTarget *qt5Rcc = makefile->FindTargetToUse("Qt5::rcc"); - if (!qt5Rcc) - { - cmSystemTools::Error("Qt5::rcc target not found ", - targetName.c_str()); - return std::string(); - } - return qt5Rcc->ImportedGetLocation(""); - } - else if (strcmp(qtVersion, "4") == 0) - { - cmTarget *qt4Rcc = makefile->FindTargetToUse("Qt4::rcc"); - if (!qt4Rcc) - { - cmSystemTools::Error("Qt4::rcc target not found ", - targetName.c_str()); - return std::string(); - } - return qt4Rcc->ImportedGetLocation(""); - } - - cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and " - "Qt 5 ", targetName.c_str()); - return std::string(); -} diff --git a/Source/cmQtAutoGeneratorInitializer.h b/Source/cmQtAutoGeneratorInitializer.h index c22f172..eaf140d 100644 --- a/Source/cmQtAutoGeneratorInitializer.h +++ b/Source/cmQtAutoGeneratorInitializer.h @@ -21,47 +21,16 @@ #include <map> class cmSourceFile; -class cmTarget; +class cmGeneratorTarget; class cmLocalGenerator; class cmQtAutoGeneratorInitializer { public: - static void InitializeAutogenSources(cmTarget* target); - static void InitializeAutogenTarget(cmLocalGenerator* lg, cmTarget* target); - static void SetupAutoGenerateTarget(cmTarget const* target); - - static std::string GetAutogenTargetName(cmTarget const* target); - static std::string GetAutogenTargetDir(cmTarget const* target); - -private: - static void SetupSourceFiles(cmTarget const* target, - std::vector<std::string>& skipMoc, - std::vector<std::string>& mocSources, - std::vector<std::string>& mocHeaders, - std::vector<std::string>& skipUic); - - static void SetupAutoMocTarget(cmTarget const* target, - const std::string &autogenTargetName, - const std::vector<std::string>& skipMoc, - const std::vector<std::string>& mocHeaders, - std::map<std::string, std::string> &configIncludes, - std::map<std::string, std::string> &configDefines); - static void SetupAutoUicTarget(cmTarget const* target, - const std::vector<std::string>& skipUic, - std::map<std::string, std::string> &configUicOptions); - static void SetupAutoRccTarget(cmTarget const* target); - - static void MergeRccOptions(std::vector<std::string> &opts, - const std::vector<std::string> &fileOpts, bool isQt5); - - static std::string GetRccExecutable(cmTarget const* target); - - static std::string ListQt5RccInputs(cmSourceFile* sf, cmTarget const* target, - std::vector<std::string>& depends); - - static std::string ListQt4RccInputs(cmSourceFile* sf, - std::vector<std::string>& depends); + static void InitializeAutogenSources(cmGeneratorTarget* target); + static void InitializeAutogenTarget(cmLocalGenerator* lg, + cmGeneratorTarget* target); + static void SetupAutoGenerateTarget(cmGeneratorTarget const* target); }; #endif diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index bbeb3dc..36b1305 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -178,9 +178,10 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, cmGlobalGenerator gg(&cm); cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); + snapshot.GetDirectory().SetCurrentBinary(targetDirectory); + snapshot.GetDirectory().SetCurrentSource(targetDirectory); + cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, snapshot)); - mf->SetCurrentBinaryDirectory(targetDirectory); - mf->SetCurrentSourceDirectory(targetDirectory); gg.SetCurrentMakefile(mf.get()); this->ReadAutogenInfoFile(mf.get(), targetDirectory, config); diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index 06217bb..b1c13ac 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -10,7 +10,6 @@ See the License for more information. ============================================================================*/ #include "cmSetTargetPropertiesCommand.h" -#include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" // cmSetTargetPropertiesCommand diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 86f0a7a..37383be 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -12,7 +12,6 @@ #include "cmSourceFile.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index 4a87cc2..b8d5c02 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -12,7 +12,6 @@ #include "cmSourceFileLocation.h" #include "cmMakefile.h" -#include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmSystemTools.h" #include "cmAlgorithms.h" diff --git a/Source/cmState.cxx b/Source/cmState.cxx index ce9ff32..db7519b 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -805,8 +805,10 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot, pos->Parent = origin; pos->Root = origin; pos->Vars = this->VarTree.Extend(origin); + cmState::Snapshot snapshot = cmState::Snapshot(this, pos); originSnapshot.Position->BuildSystemDirectory->Children.push_back(snapshot); + snapshot.InitializeFromParent(); return snapshot; } diff --git a/Source/cmState.h b/Source/cmState.h index 99e537c..1ffc4bf 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -75,8 +75,6 @@ public: Snapshot GetCallStackParent() const; SnapshotType GetType() const; - void InitializeFromParent(); - void SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status); cmPolicies::PolicyStatus GetPolicy(cmPolicies::PolicyID id) const; bool HasDefinedPolicyCMP0011(); @@ -105,6 +103,9 @@ public: friend class cmState; friend class Directory; friend struct StrictWeakOrder; + + void InitializeFromParent(); + cmState* State; cmState::PositionType Position; }; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index d3c1f16..2c5aa8a 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2777,6 +2777,14 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op, } //---------------------------------------------------------------------------- +bool cmSystemTools::VersionCompareGreater(std::string const& lhs, + std::string const& rhs) +{ + return cmSystemTools::VersionCompare( + cmSystemTools::OP_GREATER, lhs.c_str(), rhs.c_str()); +} + +//---------------------------------------------------------------------------- bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg, bool* removed) { diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index e88170a..b6b0978 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -294,6 +294,8 @@ public: * Compare versions */ static bool VersionCompare(CompareOp op, const char* lhs, const char* rhs); + static bool VersionCompareGreater(std::string const& lhs, + std::string const& rhs); /** * Determine the file type based on the extension diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index bb44956..abfc40b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -101,23 +101,9 @@ public: HeadToLinkImplementationMap> LinkImplMapType; LinkImplMapType LinkImplMap; - typedef std::map<std::string, std::vector<cmSourceFile*> > - SourceFilesMapType; - SourceFilesMapType SourceFilesMap; - std::set<cmLinkItem> UtilityItems; bool UtilityItemsDone; - class TargetPropertyEntry { - static cmLinkImplItem NoLinkImplItem; - public: - TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge, - cmLinkImplItem const& item = NoLinkImplItem) - : ge(cge), LinkImplItem(item) - {} - const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge; - cmLinkImplItem const& LinkImplItem; - }; std::vector<std::string> IncludeDirectoriesEntries; std::vector<cmListFileBacktrace> IncludeDirectoriesBacktraces; std::vector<std::string> CompileOptionsEntries; @@ -126,16 +112,11 @@ public: std::vector<cmListFileBacktrace> CompileFeaturesBacktraces; std::vector<std::string> CompileDefinitionsEntries; std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces; - std::vector<TargetPropertyEntry*> SourceEntries; + std::vector<std::string> SourceEntries; + std::vector<cmListFileBacktrace> SourceBacktraces; std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries; - - void AddInterfaceEntries( - cmTarget const* thisTarget, std::string const& config, - std::string const& prop, std::vector<TargetPropertyEntry*>& entries); }; -cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem; - //---------------------------------------------------------------------------- cmTargetInternals::~cmTargetInternals() { @@ -154,8 +135,6 @@ cmTarget::cmTarget() this->IsApple = false; this->IsImportedTarget = false; this->BuildInterfaceIncludesAppended = false; - this->DebugSourcesDone = false; - this->LinkImplementationLanguageIsContextDependent = true; } void cmTarget::SetType(TargetType type, const std::string& name) @@ -382,21 +361,6 @@ void cmTarget::SetMakefile(cmMakefile* mf) } } -void CreatePropertyGeneratorExpressions( - std::vector<std::string> const& entries, - std::vector<cmListFileBacktrace> const& backtraces, - std::vector<cmTargetInternals::TargetPropertyEntry*>& items) -{ - std::vector<cmListFileBacktrace>::const_iterator btIt = backtraces.begin(); - for (std::vector<std::string>::const_iterator it = entries.begin(); - it != entries.end(); ++it, ++btIt) - { - cmGeneratorExpression ge(*btIt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*it); - items.push_back(new cmTargetInternals::TargetPropertyEntry(cge)); - } -} - //---------------------------------------------------------------------------- void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile) { @@ -454,9 +418,7 @@ void cmTarget::FinishConfigure() //---------------------------------------------------------------------------- void cmTarget::ClearLinkMaps() { - this->LinkImplementationLanguageIsContextDependent = true; this->Internal->LinkImplMap.clear(); - this->Internal->SourceFilesMap.clear(); } //---------------------------------------------------------------------------- @@ -538,247 +500,13 @@ bool cmTarget::IsXCTestOnApple() const } //---------------------------------------------------------------------------- -static bool processSources(cmTarget const* tgt, - const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries, - std::vector<std::string> &srcs, - UNORDERED_SET<std::string> &uniqueSrcs, - cmGeneratorExpressionDAGChecker *dagChecker, - std::string const& config, bool debugSources) -{ - cmMakefile *mf = tgt->GetMakefile(); - - bool contextDependent = false; - - for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator - it = entries.begin(), end = entries.end(); it != end; ++it) - { - cmLinkImplItem const& item = (*it)->LinkImplItem; - std::string const& targetName = item; - std::vector<std::string> entrySources; - cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, - config, - false, - tgt, - tgt, - dagChecker), - entrySources); - - if ((*it)->ge->GetHadContextSensitiveCondition()) - { - contextDependent = true; - } - - for(std::vector<std::string>::iterator i = entrySources.begin(); - i != entrySources.end(); ++i) - { - std::string& src = *i; - cmSourceFile* sf = mf->GetOrCreateSource(src); - std::string e; - std::string fullPath = sf->GetFullPath(&e); - if(fullPath.empty()) - { - if(!e.empty()) - { - cmake* cm = mf->GetCMakeInstance(); - cm->IssueMessage(cmake::FATAL_ERROR, e, - tgt->GetBacktrace()); - } - return contextDependent; - } - - if (!targetName.empty() && !cmSystemTools::FileIsFullPath(src.c_str())) - { - std::ostringstream err; - if (!targetName.empty()) - { - err << "Target \"" << targetName << "\" contains relative " - "path in its INTERFACE_SOURCES:\n" - " \"" << src << "\""; - } - else - { - err << "Found relative path while evaluating sources of " - "\"" << tgt->GetName() << "\":\n \"" << src << "\"\n"; - } - tgt->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, err.str()); - return contextDependent; - } - src = fullPath; - } - std::string usedSources; - for(std::vector<std::string>::iterator - li = entrySources.begin(); li != entrySources.end(); ++li) - { - std::string src = *li; - - if(uniqueSrcs.insert(src).second) - { - srcs.push_back(src); - if (debugSources) - { - usedSources += " * " + src + "\n"; - } - } - } - if (!usedSources.empty()) - { - mf->GetCMakeInstance()->IssueMessage(cmake::LOG, - std::string("Used sources for target ") - + tgt->GetName() + ":\n" - + usedSources, (*it)->ge->GetBacktrace()); - } - } - return contextDependent; -} - -//---------------------------------------------------------------------------- -void cmTarget::GetSourceFiles(std::vector<std::string> &files, - const std::string& config) const -{ - assert(this->GetType() != INTERFACE_LIBRARY); - - if (!this->GetMakefile()->GetGlobalGenerator()->GetConfigureDoneCMP0026()) - { - // At configure-time, this method can be called as part of getting the - // LOCATION property or to export() a file to be include()d. However - // there is no cmGeneratorTarget at configure-time, so search the SOURCES - // for TARGET_OBJECTS instead for backwards compatibility with OLD - // behavior of CMP0024 and CMP0026 only. - - typedef cmTargetInternals::TargetPropertyEntry - TargetPropertyEntry; - for(std::vector<TargetPropertyEntry*>::const_iterator - i = this->Internal->SourceEntries.begin(); - i != this->Internal->SourceEntries.end(); ++i) - { - std::string entry = (*i)->ge->GetInput(); - - std::vector<std::string> items; - cmSystemTools::ExpandListArgument(entry, items); - for (std::vector<std::string>::const_iterator - li = items.begin(); li != items.end(); ++li) - { - if(cmHasLiteralPrefix(*li, "$<TARGET_OBJECTS:") && - (*li)[li->size() - 1] == '>') - { - continue; - } - files.push_back(*li); - } - } - return; - } - - std::vector<std::string> debugProperties; - const char *debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) - { - cmSystemTools::ExpandListArgument(debugProp, debugProperties); - } - - bool debugSources = !this->DebugSourcesDone - && std::find(debugProperties.begin(), - debugProperties.end(), - "SOURCES") - != debugProperties.end(); - - if (this->GetMakefile()->GetGlobalGenerator()->GetConfigureDoneCMP0026()) - { - this->DebugSourcesDone = true; - } - - cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), - "SOURCES", 0, 0); - - UNORDERED_SET<std::string> uniqueSrcs; - bool contextDependentDirectSources = processSources(this, - this->Internal->SourceEntries, - files, - uniqueSrcs, - &dagChecker, - config, - debugSources); - - std::vector<cmTargetInternals::TargetPropertyEntry*> - linkInterfaceSourcesEntries; - - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_SOURCES", - linkInterfaceSourcesEntries); - - std::vector<std::string>::size_type numFilesBefore = files.size(); - bool contextDependentInterfaceSources = processSources(this, - linkInterfaceSourcesEntries, - files, - uniqueSrcs, - &dagChecker, - config, - debugSources); - - if (!contextDependentDirectSources - && !(contextDependentInterfaceSources && numFilesBefore < files.size())) - { - this->LinkImplementationLanguageIsContextDependent = false; - } - - cmDeleteAll(linkInterfaceSourcesEntries); -} - -//---------------------------------------------------------------------------- -void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files, - const std::string& config) const -{ - - // Lookup any existing link implementation for this configuration. - std::string key = cmSystemTools::UpperCase(config); - - if(!this->LinkImplementationLanguageIsContextDependent) - { - files = this->Internal->SourceFilesMap.begin()->second; - return; - } - - cmTargetInternals::SourceFilesMapType::iterator - it = this->Internal->SourceFilesMap.find(key); - if(it != this->Internal->SourceFilesMap.end()) - { - files = it->second; - } - else - { - std::vector<std::string> srcs; - this->GetSourceFiles(srcs, config); - - std::set<cmSourceFile*> emitted; - - for(std::vector<std::string>::const_iterator i = srcs.begin(); - i != srcs.end(); ++i) - { - cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i); - if (emitted.insert(sf).second) - { - files.push_back(sf); - } - } - this->Internal->SourceFilesMap[key] = files; - } -} - -//---------------------------------------------------------------------------- void cmTarget::AddTracedSources(std::vector<std::string> const& srcs) { - std::string srcFiles = cmJoin(srcs, ";"); - if (!srcFiles.empty()) + if (!srcs.empty()) { - this->Internal->SourceFilesMap.clear(); - this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); - cge->SetEvaluateForBuildsystem(true); - this->Internal->SourceEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); + this->Internal->SourceEntries.push_back(cmJoin(srcs, ";")); + this->Internal->SourceBacktraces.push_back(lfbt); } } @@ -811,14 +539,9 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs) } if (!srcFiles.empty()) { - this->Internal->SourceFilesMap.clear(); - this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); - cge->SetEvaluateForBuildsystem(true); - this->Internal->SourceEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); + this->Internal->SourceEntries.push_back(srcFiles); + this->Internal->SourceBacktraces.push_back(lfbt); } } @@ -922,10 +645,10 @@ public: } - bool operator()(cmTargetInternals::TargetPropertyEntry* entry) + bool operator()(std::string const& entry) { std::vector<std::string> files; - cmSystemTools::ExpandListArgument(entry->ge->GetInput(), files); + cmSystemTools::ExpandListArgument(entry, files); std::vector<cmSourceFileLocation> locations(files.size()); std::transform(files.begin(), files.end(), locations.begin(), CreateLocation(this->Needle.GetMakefile())); @@ -944,14 +667,9 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) TargetPropertyEntryFinder(sfl)) == this->Internal->SourceEntries.end()) { - this->Internal->SourceFilesMap.clear(); - this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); - cge->SetEvaluateForBuildsystem(true); - this->Internal->SourceEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); + this->Internal->SourceEntries.push_back(src); + this->Internal->SourceBacktraces.push_back(lfbt); } if (cmGeneratorExpression::Find(src) != std::string::npos) { @@ -1254,6 +972,16 @@ cmBacktraceRange cmTarget::GetCompileDefinitionsBacktraces() const return cmMakeRange(this->Internal->CompileDefinitionsBacktraces); } +cmStringRange cmTarget::GetSourceEntries() const +{ + return cmMakeRange(this->Internal->SourceEntries); +} + +cmBacktraceRange cmTarget::GetSourceBacktraces() const +{ + return cmMakeRange(this->Internal->SourceBacktraces); +} + #if defined(_WIN32) && !defined(__CYGWIN__) //---------------------------------------------------------------------------- void @@ -1669,14 +1397,15 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } - this->Internal->SourceFilesMap.clear(); - cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - cmDeleteAll(this->Internal->SourceEntries); + this->Internal->SourceEntries.clear(); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); - this->Internal->SourceEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); + this->Internal->SourceBacktraces.clear(); + if (value) + { + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + this->Internal->SourceEntries.push_back(value); + this->Internal->SourceBacktraces.push_back(lfbt); + } } else { @@ -1767,12 +1496,9 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } - this->Internal->SourceFilesMap.clear(); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); - this->Internal->SourceEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); + this->Internal->SourceEntries.push_back(value); + this->Internal->SourceBacktraces.push_back(lfbt); } else { @@ -2409,13 +2135,11 @@ const char *cmTarget::GetProperty(const std::string& prop, std::ostringstream ss; const char* sep = ""; - typedef cmTargetInternals::TargetPropertyEntry - TargetPropertyEntry; - for(std::vector<TargetPropertyEntry*>::const_iterator + for(std::vector<std::string>::const_iterator i = this->Internal->SourceEntries.begin(); i != this->Internal->SourceEntries.end(); ++i) { - std::string entry = (*i)->ge->GetInput(); + std::string const& entry = *i; std::vector<std::string> files; cmSystemTools::ExpandListArgument(entry, files); @@ -3067,13 +2791,11 @@ cmTarget::GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const // there is no cmGeneratorTarget at configure-time, so search the SOURCES // for TARGET_OBJECTS instead for backwards compatibility with OLD // behavior of CMP0024 and CMP0026 only. - typedef cmTargetInternals::TargetPropertyEntry - TargetPropertyEntry; - for(std::vector<TargetPropertyEntry*>::const_iterator + for(std::vector<std::string>::const_iterator i = this->Internal->SourceEntries.begin(); i != this->Internal->SourceEntries.end(); ++i) { - std::string entry = (*i)->ge->GetInput(); + std::string const& entry = *i; std::vector<std::string> files; cmSystemTools::ExpandListArgument(entry, files); @@ -3448,32 +3170,6 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, } } -//---------------------------------------------------------------------------- -void cmTargetInternals::AddInterfaceEntries( - cmTarget const* thisTarget, std::string const& config, - std::string const& prop, std::vector<TargetPropertyEntry*>& entries) -{ - if(cmLinkImplementationLibraries const* impl = - thisTarget->GetLinkImplementationLibraries(config)) - { - for (std::vector<cmLinkImplItem>::const_iterator - it = impl->Libraries.begin(), end = impl->Libraries.end(); - it != end; ++it) - { - if(it->Target) - { - std::string genex = - "$<TARGET_PROPERTY:" + *it + "," + prop + ">"; - cmGeneratorExpression ge(it->Backtrace); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex); - cge->SetEvaluateForBuildsystem(true); - entries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge, *it)); - } - } - } -} - cmOptionalLinkImplementation& cmTarget::GetLinkImplMap(std::string const& config) const { @@ -3736,7 +3432,6 @@ cmTargetInternalPointer //---------------------------------------------------------------------------- cmTargetInternalPointer::~cmTargetInternalPointer() { - cmDeleteAll(this->Pointer->SourceEntries); delete this->Pointer; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 3e71dbd..354eda2 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -134,11 +134,6 @@ public: {this->PostBuildCommands.push_back(cmd);} /** - * Get the list of the source files used by this target - */ - void GetSourceFiles(std::vector<cmSourceFile*> &files, - const std::string& config) const; - /** * Add sources to the target. */ void AddSources(std::vector<std::string> const& srcs); @@ -388,6 +383,9 @@ public: cmStringRange GetCompileDefinitionsEntries() const; cmBacktraceRange GetCompileDefinitionsBacktraces() const; + cmStringRange GetSourceEntries() const; + cmBacktraceRange GetSourceBacktraces() const; + #if defined(_WIN32) && !defined(__CYGWIN__) const LinkLibraryVectorType &GetLinkLibrariesForVS6() const { return this->LinkLibrariesForVS6;} @@ -466,9 +464,6 @@ private: std::string ImportedGetFullPath(const std::string& config, bool implib) const; - - void GetSourceFiles(std::vector<std::string> &files, - const std::string& config) const; private: mutable cmPropertyMap Properties; std::set<std::string> SystemIncludeDirectories; @@ -502,8 +497,6 @@ private: bool IsApple; bool IsImportedTarget; bool BuildInterfaceIncludesAppended; - mutable bool DebugSourcesDone; - mutable bool LinkImplementationLanguageIsContextDependent; #if defined(_WIN32) && !defined(__CYGWIN__) bool LinkLibrariesForVS6Analyzed; #endif diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 6c71313..2395ce7 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -463,6 +463,7 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteString("<Import Project=\"" VS10_USER_PROPS "\"" " Condition=\"exists('" VS10_USER_PROPS "')\"" " Label=\"LocalAppDataPlatform\" />\n", 2); + this->WritePlatformExtensions(); this->WriteString("</ImportGroup>\n", 1); this->WriteString("<PropertyGroup Label=\"UserMacros\" />\n", 1); this->WriteWinRTPackageCertificateKeyFile(); @@ -475,6 +476,7 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteXamlFilesGroup(); this->WriteWinRTReferences(); this->WriteProjectReferences(); + this->WriteSDKReferences(); this->WriteString( "<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\"" " />\n", 1); @@ -1307,6 +1309,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) { tool = "XML"; } + if(this->NsightTegra) { // Nsight Tegra needs specific file types to check up-to-dateness. @@ -2590,7 +2593,8 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) // A Windows Runtime component uses internal .NET metadata, // so does not have an import library. - if(this->Target->GetPropertyAsBool("VS_WINRT_COMPONENT")) + if(this->Target->GetPropertyAsBool("VS_WINRT_COMPONENT") && + this->Target->GetType() != cmTarget::EXECUTABLE) { linkOptions.AddFlag("GenerateWindowsMetadata", "true"); } @@ -2661,7 +2665,7 @@ cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& config) { this->WriteString("<ProjectReference>\n", 2); this->WriteString( - " <LinkLibraryDependencies>false</LinkLibraryDependencies>\n", 2); + "<LinkLibraryDependencies>false</LinkLibraryDependencies>\n", 3); this->WriteString("</ProjectReference>\n", 2); } } @@ -2896,6 +2900,101 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() this->WriteString("</ItemGroup>\n", 1); } +void cmVisualStudio10TargetGenerator::WritePlatformExtensions() +{ + // This only applies to Windows 10 apps + if (this->GlobalGenerator->TargetsWindowsStore() && + cmHasLiteralPrefix(this->GlobalGenerator->GetSystemVersion(), "10.0")) + { + const char* desktopExtensionsVersion = + this->Target->GetProperty("VS_DESKTOP_EXTENSIONS_VERSION"); + if (desktopExtensionsVersion) + { + this->WriteSinglePlatformExtension("WindowsDesktop", + desktopExtensionsVersion); + } + const char* mobileExtensionsVersion = + this->Target->GetProperty("VS_MOBILE_EXTENSIONS_VERSION"); + if (mobileExtensionsVersion) + { + this->WriteSinglePlatformExtension("WindowsMobile", + mobileExtensionsVersion); + } + } +} + +void cmVisualStudio10TargetGenerator::WriteSinglePlatformExtension( + std::string const& extension, + std::string const& version + ) +{ + this->WriteString("<Import Project=", 2); + (*this->BuildFileStream) + << "\"$([Microsoft.Build.Utilities.ToolLocationHelper]" + << "::GetPlatformExtensionSDKLocation(`" + << extension <<", Version=" << version + << "`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), null, " + << "$(ExtensionSDKDirectoryRoot), null))" + << "\\DesignTime\\CommonConfiguration\\Neutral\\" + << extension << ".props\" " + << "Condition=\"exists('$(" + << "[Microsoft.Build.Utilities.ToolLocationHelper]" + << "::GetPlatformExtensionSDKLocation(`" + << extension << ", Version=" << version + << "`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), null, " + << "$(ExtensionSDKDirectoryRoot), null))" + << "\\DesignTime\\CommonConfiguration\\Neutral\\" + << extension << ".props')\" />\n"; +} + +void cmVisualStudio10TargetGenerator::WriteSDKReferences() +{ + // This only applies to Windows 10 apps + if (this->GlobalGenerator->TargetsWindowsStore() && + cmHasLiteralPrefix(this->GlobalGenerator->GetSystemVersion(), "10.0")) + { + const char* desktopExtensionsVersion = + this->Target->GetProperty("VS_DESKTOP_EXTENSIONS_VERSION"); + const char* mobileExtensionsVersion = + this->Target->GetProperty("VS_MOBILE_EXTENSIONS_VERSION"); + const char* iotExtensionsVersion = + this->Target->GetProperty("VS_IOT_EXTENSIONS_VERSION"); + + if(desktopExtensionsVersion || mobileExtensionsVersion || + iotExtensionsVersion) + { + this->WriteString("<ItemGroup>\n", 1); + if(desktopExtensionsVersion) + { + this->WriteSingleSDKReference("WindowsDesktop", + desktopExtensionsVersion); + } + if(mobileExtensionsVersion) + { + this->WriteSingleSDKReference("WindowsMobile", + mobileExtensionsVersion); + } + if(iotExtensionsVersion) + { + this->WriteSingleSDKReference("WindowsIoT", + iotExtensionsVersion); + } + this->WriteString("</ItemGroup>\n", 1); + } + } +} + +void cmVisualStudio10TargetGenerator::WriteSingleSDKReference( + std::string const& extension, + std::string const& version + ) +{ + this->WriteString("<SDKReference Include=\"", 2); + (*this->BuildFileStream) << extension + << ", Version=" << version << "\" />\n"; +} + + void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile() { if((this->GlobalGenerator->TargetsWindowsStore() || @@ -3006,6 +3105,8 @@ IsXamlSource(const std::string& sourceFile) void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() { + cmGlobalVisualStudio10Generator* gg = + static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator); bool isAppContainer = false; bool const isWindowsPhone = this->GlobalGenerator->TargetsWindowsPhone(); bool const isWindowsStore = this->GlobalGenerator->TargetsWindowsStore(); @@ -3016,13 +3117,27 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() (*this->BuildFileStream) << (isWindowsPhone ? "Windows Phone" : "Windows Store") << "</ApplicationType>\n"; - this->WriteString("<ApplicationTypeRevision>", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(v) - << "</ApplicationTypeRevision>\n"; this->WriteString("<DefaultLanguage>en-US" "</DefaultLanguage>\n", 2); - if(v == "8.1") + if (cmHasLiteralPrefix(v, "10.0")) { + this->WriteString("<ApplicationTypeRevision>", 2); + (*this->BuildFileStream) << cmVS10EscapeXML("10.0") + << "</ApplicationTypeRevision>\n"; + // Visual Studio 14.0 is necessary for building 10.0 apps + this->WriteString("<MinimumVisualStudioVersion>14.0" + "</MinimumVisualStudioVersion>\n", 2); + + if(this->Target->GetType() < cmTarget::UTILITY) + { + isAppContainer = true; + } + } + else if(v == "8.1") + { + this->WriteString("<ApplicationTypeRevision>", 2); + (*this->BuildFileStream) << cmVS10EscapeXML(v) + << "</ApplicationTypeRevision>\n"; // Visual Studio 12.0 is necessary for building 8.1 apps this->WriteString("<MinimumVisualStudioVersion>12.0" "</MinimumVisualStudioVersion>\n", 2); @@ -3034,6 +3149,9 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() } else if (v == "8.0") { + this->WriteString("<ApplicationTypeRevision>", 2); + (*this->BuildFileStream) << cmVS10EscapeXML(v) + << "</ApplicationTypeRevision>\n"; // Visual Studio 11.0 is necessary for building 8.0 apps this->WriteString("<MinimumVisualStudioVersion>11.0" "</MinimumVisualStudioVersion>\n", 2); @@ -3062,6 +3180,38 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() this->WriteString("<WindowsSDKDesktopARMSupport>true" "</WindowsSDKDesktopARMSupport>\n", 2); } + std::string const& targetPlatformVersion = + gg->GetWindowsTargetPlatformVersion(); + if (!targetPlatformVersion.empty()) + { + this->WriteString("<WindowsTargetPlatformVersion>", 2); + (*this->BuildFileStream) << cmVS10EscapeXML(targetPlatformVersion) << + "</WindowsTargetPlatformVersion>\n"; + } + const char* targetPlatformMinVersion = + this->Target->GetProperty("VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION"); + if(targetPlatformMinVersion) + { + this->WriteString("<WindowsTargetPlatformMinVersion>", 2); + (*this->BuildFileStream) << cmVS10EscapeXML(targetPlatformMinVersion) << + "</WindowsTargetPlatformMinVersion>\n"; + } + else if (isWindowsStore && cmHasLiteralPrefix(v, "10.0")) + { + // If the min version is not set, then use the TargetPlatformVersion + if (!targetPlatformVersion.empty()) + { + this->WriteString("<WindowsTargetPlatformMinVersion>", 2); + (*this->BuildFileStream) << cmVS10EscapeXML(targetPlatformVersion) << + "</WindowsTargetPlatformMinVersion>\n"; + } + } + + // Added IoT Startup Task support + if(this->Target->GetPropertyAsBool("VS_IOT_STARTUP_TASK")) + { + this->WriteString("<ContainsStartupTask>true</ContainsStartupTask>\n", 2); + } } void cmVisualStudio10TargetGenerator::VerifyNecessaryFiles() @@ -3114,7 +3264,7 @@ void cmVisualStudio10TargetGenerator::VerifyNecessaryFiles() { this->IsMissingFiles = true; } - else if (v == "8.1") + else if (v == "8.1" || cmHasLiteralPrefix(v, "10.0")) { this->IsMissingFiles = true; } @@ -3148,6 +3298,10 @@ void cmVisualStudio10TargetGenerator::WriteMissingFiles() { this->WriteMissingFilesWS81(); } + else if (cmHasLiteralPrefix(v, "10.0")) + { + this->WriteMissingFilesWS10_0(); + } } } @@ -3409,6 +3563,64 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81() this->WriteCommonMissingFiles(manifestFile); } +void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0() +{ + std::string manifestFile = + this->DefaultArtifactDir + "/package.appxManifest"; + std::string artifactDir = + this->LocalGenerator->GetTargetDirectory(*this->Target); + this->ConvertToWindowsSlash(artifactDir); + std::string artifactDirXML = cmVS10EscapeXML(artifactDir); + std::string targetNameXML = cmVS10EscapeXML(this->Target->GetName()); + + cmGeneratedFileStream fout(manifestFile.c_str()); + fout.SetCopyIfDifferent(true); + + fout << + "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<Package\n\t" + "xmlns=\"http://schemas.microsoft.com/appx/manifest/foundation/windows10\"" + "\txmlns:mp=\"http://schemas.microsoft.com/appx/2014/phone/manifest\"\n" + "\txmlns:uap=\"http://schemas.microsoft.com/appx/manifest/uap/windows10\"" + "\n\tIgnorableNamespaces=\"uap mp\">\n\n" + "\t<Identity Name=\"" << this->GUID << "\" Publisher=\"CN=CMake\"" + " Version=\"1.0.0.0\" />\n" + "\t<mp:PhoneIdentity PhoneProductId=\"" << this->GUID << + "\" PhonePublisherId=\"00000000-0000-0000-0000-000000000000\"/>\n" + "\t<Properties>\n" + "\t\t<DisplayName>" << targetNameXML << "</DisplayName>\n" + "\t\t<PublisherDisplayName>CMake</PublisherDisplayName>\n" + "\t\t<Logo>" << artifactDirXML << "\\StoreLogo.png</Logo>\n" + "\t</Properties>\n" + "\t<Dependencies>\n" + "\t\t<TargetDeviceFamily Name=\"Windows.Universal\" " + "MinVersion=\"10.0.0.0\" MaxVersionTested=\"10.0.0.0\" />\n" + "\t</Dependencies>\n" + + "\t<Resources>\n" + "\t\t<Resource Language=\"x-generate\" />\n" + "\t</Resources>\n" + "\t<Applications>\n" + "\t\t<Application Id=\"App\"" + " Executable=\"" << targetNameXML << ".exe\"" + " EntryPoint=\"" << targetNameXML << ".App\">\n" + "\t\t\t<uap:VisualElements\n" + "\t\t\t\tDisplayName=\"" << targetNameXML << "\"\n" + "\t\t\t\tDescription=\"" << targetNameXML << "\"\n" + "\t\t\t\tBackgroundColor=\"#336699\"\n" + "\t\t\t\tSquare150x150Logo=\"" << artifactDirXML << "\\Logo.png\"\n" + "\t\t\t\tSquare44x44Logo=\"" << artifactDirXML << + "\\SmallLogo44x44.png\">\n" + "\t\t\t\t<uap:SplashScreen" + " Image=\"" << artifactDirXML << "\\SplashScreen.png\" />\n" + "\t\t\t</uap:VisualElements>\n" + "\t\t</Application>\n" + "\t</Applications>\n" + "</Package>\n"; + + this->WriteCommonMissingFiles(manifestFile); +} + void cmVisualStudio10TargetGenerator ::WriteCommonMissingFiles(const std::string& manifestFile) @@ -3432,6 +3644,14 @@ cmVisualStudio10TargetGenerator (*this->BuildFileStream) << cmVS10EscapeXML(smallLogo) << "\" />\n"; this->AddedFiles.push_back(smallLogo); + std::string smallLogo44 = this->DefaultArtifactDir + "/SmallLogo44x44.png"; + cmSystemTools::CopyAFile(templateFolder + "/SmallLogo44x44.png", + smallLogo44, false); + this->ConvertToWindowsSlash(smallLogo44); + this->WriteString("<Image Include=\"", 2); + (*this->BuildFileStream) << cmVS10EscapeXML(smallLogo44) << "\" />\n"; + this->AddedFiles.push_back(smallLogo44); + std::string logo = this->DefaultArtifactDir + "/Logo.png"; cmSystemTools::CopyAFile(templateFolder + "/Logo.png", logo, false); @@ -3475,7 +3695,7 @@ bool cmVisualStudio10TargetGenerator::ForceOld(const std::string& source) const return false; } - FILETIME const ftime_20010101 = { 3365781504, 29389701 }; + FILETIME const ftime_20010101 = { 3365781504u, 29389701u }; if (!SetFileTime(h, &ftime_20010101, &ftime_20010101, &ftime_20010101)) { CloseHandle(h); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index f2aaf05..15ed9f2 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -78,6 +78,13 @@ private: void WriteMissingFilesWP81(); void WriteMissingFilesWS80(); void WriteMissingFilesWS81(); + void WriteMissingFilesWS10_0(); + void WritePlatformExtensions(); + void WriteSinglePlatformExtension(std::string const& extension, + std::string const& version); + void WriteSDKReferences(); + void WriteSingleSDKReference(std::string const& extension, + std::string const& version); void WriteCommonMissingFiles(const std::string& manifestFile); void WriteTargetSpecificReferences(); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 386f6a5..fececfd 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -377,21 +377,20 @@ void cmake::ReadListFile(const std::vector<std::string>& args, this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); cmState::Snapshot snapshot = this->GetCurrentSnapshot(); - cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot)); - cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get())); - lg->GetMakefile()->SetCurrentBinaryDirectory + snapshot.GetDirectory().SetCurrentBinary (cmSystemTools::GetCurrentWorkingDirectory()); - lg->GetMakefile()->SetCurrentSourceDirectory + snapshot.GetDirectory().SetCurrentSource (cmSystemTools::GetCurrentWorkingDirectory()); + cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot)); if (this->GetWorkingMode() != NORMAL_MODE) { std::string file(cmSystemTools::CollapseFullPath(path)); cmSystemTools::ConvertToUnixSlashes(file); - lg->GetMakefile()->SetScriptModeFile(file.c_str()); + mf->SetScriptModeFile(file.c_str()); - lg->GetMakefile()->SetArgcArgv(args); + mf->SetArgcArgv(args); } - if (!lg->GetMakefile()->ReadListFile(path)) + if (!mf->ReadListFile(path)) { cmSystemTools::Error("Error processing file: ", path); } @@ -419,13 +418,13 @@ bool cmake::FindPackage(const std::vector<std::string>& args) this->SetGlobalGenerator(gg); cmState::Snapshot snapshot = this->GetCurrentSnapshot(); + snapshot.GetDirectory().SetCurrentBinary + (cmSystemTools::GetCurrentWorkingDirectory()); + snapshot.GetDirectory().SetCurrentSource + (cmSystemTools::GetCurrentWorkingDirectory()); // read in the list file to fill the cache cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot)); cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get())); - mf->SetCurrentBinaryDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); - mf->SetCurrentSourceDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); mf->SetArgcArgv(args); @@ -1906,7 +1905,6 @@ int cmake::CheckBuildSystem() cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); - cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get())); if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) || cmSystemTools::GetErrorOccuredFlag()) { diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index f44c77d..ca46111 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -769,11 +769,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) { cm.SetGlobalGenerator(ggd); cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); + snapshot.GetDirectory().SetCurrentBinary + (cmSystemTools::GetCurrentWorkingDirectory()); + snapshot.GetDirectory().SetCurrentSource + (cmSystemTools::GetCurrentWorkingDirectory()); cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(ggd, snapshot)); cmsys::auto_ptr<cmLocalGenerator> lgd( ggd->CreateLocalGenerator(mf.get())); - lgd->GetMakefile()->SetCurrentSourceDirectory(startDir); - lgd->GetMakefile()->SetCurrentBinaryDirectory(startOutDir); // Actually scan dependencies. return lgd->UpdateDependencies(depInfo.c_str(), diff --git a/Source/kwsys/EncodingCXX.cxx b/Source/kwsys/EncodingCXX.cxx index 7d9b3e4..597d4bd 100644 --- a/Source/kwsys/EncodingCXX.cxx +++ b/Source/kwsys/EncodingCXX.cxx @@ -38,6 +38,7 @@ // Windows API. #if defined(_WIN32) # include <windows.h> +# include <shellapi.h> #endif namespace KWSYS_NAMESPACE diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 80289b8..262af27 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -408,6 +408,7 @@ class SystemToolsPathCaseMap: // adds the elements of the env variable path to the arg passed in void SystemTools::GetPath(std::vector<std::string>& path, const char* env) { + size_t const old_size = path.size(); #if defined(_WIN32) && !defined(__CYGWIN__) const char pathSep = ';'; #else @@ -445,7 +446,7 @@ void SystemTools::GetPath(std::vector<std::string>& path, const char* env) done = true; } } - for(std::vector<std::string>::iterator i = path.begin(); + for(std::vector<std::string>::iterator i = path.begin() + old_size; i != path.end(); ++i) { SystemTools::ConvertToUnixSlashes(*i); diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index d2d1d40..bba5a5c 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -703,13 +703,13 @@ public: /** * Create a symbolic link if the platform supports it. Returns whether - * creation succeded. + * creation succeeded. */ static bool CreateSymlink(const std::string& origName, const std::string& newName); /** * Read the contents of a symbolic link. Returns whether reading - * succeded. + * succeeded. */ static bool ReadSymlink(const std::string& newName, std::string& origName); diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index e14d2fc..a0f904f 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -28,6 +28,7 @@ #include <testSystemTools.h> #include <iostream> +#include <sstream> #include <string.h> /* strcmp */ #if defined(_WIN32) && !defined(__CYGWIN__) # include <io.h> /* _umask (MSVC) / umask (Borland) */ @@ -790,6 +791,66 @@ static bool CheckCollapsePath() return res; } +static std::string StringVectorToString(const std::vector<std::string>& vec) +{ + std::stringstream ss; + ss << "vector("; + for (std::vector<std::string>::const_iterator i = vec.begin(); + i != vec.end(); ++i) + { + if (i != vec.begin()) + { + ss << ", "; + } + ss << *i; + } + ss << ")"; + return ss.str(); +} + +static bool CheckGetPath() +{ + const char* envName = "S"; +#ifdef _WIN32 + const char* envValue = "C:\\Somewhere\\something;D:\\Temp"; +#else + const char* envValue = "/Somewhere/something:/tmp"; +#endif + const char* registryPath = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MyApp; MyKey]"; + + std::vector<std::string> originalPathes; + originalPathes.push_back(registryPath); + + std::vector<std::string> expectedPathes; + expectedPathes.push_back(registryPath); +#ifdef _WIN32 + expectedPathes.push_back("C:/Somewhere/something"); + expectedPathes.push_back("D:/Temp"); +#else + expectedPathes.push_back("/Somewhere/something"); + expectedPathes.push_back("/tmp"); +#endif + + bool res = true; + res &= CheckPutEnv(std::string(envName) + "=" + envValue, envName, envValue); + + std::vector<std::string> pathes = originalPathes; + kwsys::SystemTools::GetPath(pathes, envName); + + if (pathes != expectedPathes) + { + std::cerr << + "GetPath(" << StringVectorToString(originalPathes) << + ", " << envName << ") yielded " << StringVectorToString(pathes) << + " instead of " << StringVectorToString(expectedPathes) << + std::endl; + res = false; + } + + res &= CheckUnPutEnv(envName, envName); + return res; +} + //---------------------------------------------------------------------------- int testSystemTools(int, char*[]) { @@ -825,5 +886,7 @@ int testSystemTools(int, char*[]) res &= CheckCollapsePath(); + res &= CheckGetPath(); + return res ? 0 : 1; } diff --git a/Templates/Windows/SmallLogo44x44.png b/Templates/Windows/SmallLogo44x44.png Binary files differnew file mode 100644 index 0000000..28810b7 --- /dev/null +++ b/Templates/Windows/SmallLogo44x44.png diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index dc65a2e..3f28c25 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -687,12 +687,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(CMAKE_BUILD_NIGHTLY_RELEASES) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWindows dash2win64_release.cmake) - ADD_NIGHTLY_BUILD_TEST(CMakeNightlyMac - dashmacmini2_release.cmake) - ADD_NIGHTLY_BUILD_TEST(CMakeNightlyMac64 + ADD_NIGHTLY_BUILD_TEST(CMakeNightlyOSX dashmacmini5_release.cmake) - ADD_NIGHTLY_BUILD_TEST(CMakeNightlyLinux + ADD_NIGHTLY_BUILD_TEST(CMakeNightlyLinux32 magrathea_release.cmake) + ADD_NIGHTLY_BUILD_TEST(CMakeNightlyLinux64 + linux64_release.cmake) endif() # add tests with more complex invocations @@ -1955,13 +1955,15 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(reg_vs10 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]") set(reg_vs11 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]") set(reg_vs12 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]") + set(reg_vs14 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]") set(reg_ws80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]") set(reg_ws81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]") + set(reg_ws10_0 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\Build Tools for Windows 10;srcPath]") set(reg_wp80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.0;InstallationFolder]") set(reg_wp81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.1;InstallationFolder]") select_wince_sdk(reg_wince wince_sdk) set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]") - foreach(reg vs10 vs11 vs12 ws80 ws81 wp80 wp81 wince tegra) + foreach(reg vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra) get_filename_component(r "${reg_${reg}}" ABSOLUTE) if(IS_DIRECTORY "${r}") set(${reg} 1) @@ -2008,6 +2010,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release -DCMAKE_SYSTEM_VERSION=8.1 ) endif() + if(vs14 AND ws10_0) + add_test_VSWinStorePhone(vs14-store10_0-X86 "Visual Studio 14 2015" WindowsStore 10.0) + add_test_VSWinStorePhone(vs14-store10_0-ARM "Visual Studio 14 2015 ARM" WindowsStore 10.0) + add_test_VSWinStorePhone(vs14-store10_0-X64 "Visual Studio 14 2015 Win64" WindowsStore 10.0) + endif() if(vs11 AND wp80) add_test_VSWinStorePhone(vs11-phone80-X86 "Visual Studio 11 2012" WindowsPhone 8.0) add_test_VSWinStorePhone(vs11-phone80-ARM "Visual Studio 11 2012 ARM" WindowsPhone 8.0) diff --git a/Tests/FindPackageModeMakefileTest/Makefile.in b/Tests/FindPackageModeMakefileTest/Makefile.in index e4df9d6..8e7ff72 100644 --- a/Tests/FindPackageModeMakefileTest/Makefile.in +++ b/Tests/FindPackageModeMakefileTest/Makefile.in @@ -4,6 +4,7 @@ include cmakeExecutable.mk CMAKE_CURRENT_BINARY_DIR = "@CMAKE_CURRENT_BINARY_DIR@" CMAKE_CXX_COMPILER = "@CMAKE_CXX_COMPILER@" CMAKE_CXX_COMPILER_ID = "@CMAKE_CXX_COMPILER_ID@" +CMAKE_CXX_FLAGS = @CMAKE_CXX_FLAGS@ CMAKE_FOO = $(CMAKE) --find-package -DCMAKE_MODULE_PATH=$(CMAKE_CURRENT_BINARY_DIR) -DNAME=Foo -DLANGUAGE=CXX -DCOMPILER_ID=$(CMAKE_CXX_COMPILER_ID) @@ -14,7 +15,7 @@ all: pngtest main.o: clean main.cpp @$(CMAKE_FOO) -DMODE=COMPILE >$(tmp) @foo="`cat $(tmp)`"; \ - printf '"%s" %s %s -c main.cpp\n' $(CMAKE_CXX_COMPILER) "$(CXXFLAGS)" "$$foo" >$(tmp) + printf '"%s" %s %s -c main.cpp\n' $(CMAKE_CXX_COMPILER) "$(CMAKE_CXX_FLAGS)" "$$foo" >$(tmp) @cat $(tmp) @sh $(tmp) @rm -f $(tmp) @@ -22,7 +23,7 @@ main.o: clean main.cpp pngtest: main.o @$(CMAKE_FOO) -DMODE=LINK >$(tmp) @foo="`cat $(tmp)`"; \ - printf '"%s" %s %s -o pngtest main.o %s\n' $(CMAKE_CXX_COMPILER) "$(CXXFLAGS)" "$(LDFLAGS)" "$$foo" >$(tmp) + printf '"%s" %s %s -o pngtest main.o %s\n' $(CMAKE_CXX_COMPILER) "$(CMAKE_CXX_FLAGS)" "$(LDFLAGS)" "$$foo" >$(tmp) @cat $(tmp) @sh $(tmp) @rm -f $(tmp) diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index 7ea2a24..aef1086 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -10,47 +10,12 @@ function(run_cpack_test TEST_NAME types build) file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") # execute cmake - execute_process( - COMMAND "${CMAKE_COMMAND}" -DRunCMake_TEST=${TEST_NAME} - -DGENERATOR_TYPE=${TEST_TYPE} "${RunCMake_SOURCE_DIR}" - WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" - RESULT_VARIABLE res - OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" - ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt" - ) - - if(res) - run_cmake_command( - ${TEST_TYPE}/${TEST_NAME} - "${CMAKE_COMMAND}" - -DRunCMake_TEST_STEP=configure - -Dreturn_code=${res} - "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" - -P "${RunCMake_SOURCE_DIR}/PreTestError.cmake" - ) - return() - endif() + set(RunCMake_TEST_OPTIONS "-DGENERATOR_TYPE=${TEST_TYPE}") + run_cmake(${TEST_NAME}) # execute optional build step if(build) - execute_process( - COMMAND "${CMAKE_COMMAND}" --build "${RunCMake_TEST_BINARY_DIR}" - RESULT_VARIABLE res - OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" - ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt" - ) - endif() - - if(res) - run_cmake_command( - ${TEST_TYPE}/${TEST_NAME} - "${CMAKE_COMMAND}" - -DRunCMake_TEST_STEP=build - -Dreturn_code=${res} - "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" - -P "${RunCMake_SOURCE_DIR}/PreTestError.cmake" - ) - return() + run_cmake_command(${TEST_NAME}-Build "${CMAKE_COMMAND}" --build "${RunCMake_TEST_BINARY_DIR}") endif() # execute cpack diff --git a/Tests/RunCMake/CPack/DEPENDENCIES.cmake b/Tests/RunCMake/CPack/DEPENDENCIES.cmake index 0aef925..4f6d65f 100644 --- a/Tests/RunCMake/CPack/DEPENDENCIES.cmake +++ b/Tests/RunCMake/CPack/DEPENDENCIES.cmake @@ -1,11 +1,13 @@ +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" - "int test_lib();") + "int test_lib();\n") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" - "#include \"test_lib.hpp\"\nint test_lib() {return 0;}") + "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "#include \"test_lib.hpp\"\nint main() {return test_lib();}") + "#include \"test_lib.hpp\"\nint main() {return test_lib();}\n") add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") target_link_libraries(test_prog test_lib) diff --git a/Tests/RunCMake/CPack/PreTestError.cmake b/Tests/RunCMake/CPack/PreTestError.cmake deleted file mode 100644 index f88f2e8..0000000 --- a/Tests/RunCMake/CPack/PreTestError.cmake +++ /dev/null @@ -1,7 +0,0 @@ -file(READ "${bin_dir}/test_output.txt" output) -file(READ "${bin_dir}/test_error.txt" error) - -message(FATAL_ERROR "Error in pre-test phase '${RunCMake_TEST_STEP}'!\n" - "Return code: '${return_code}'\n" - "Info output: '${output}'\n" - "Error output: '${error}'") diff --git a/Tests/RunCMake/CommandLine/P_working-dir.cmake b/Tests/RunCMake/CommandLine/P_working-dir.cmake new file mode 100644 index 0000000..4ea0293 --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_working-dir.cmake @@ -0,0 +1,14 @@ +if(NOT IS_DIRECTORY "${EXPECTED_WORKING_DIR}") + message(FATAL_ERROR "EXPECTED_WORKING_DIR is not a directory: ${EXPECTED_WORKING_DIR}") +endif() + +foreach(d CMAKE_BINARY_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRENT_SOURCE_DIR) + if(NOT DEFINED ${d}) + message(FATAL_ERROR "${d} is not defined") + endif() + if(EXPECTED_WORKING_DIR STREQUAL "${${d}}") + message(STATUS "${d} is the expected working directory (${EXPECTED_WORKING_DIR})") + else() + message(FATAL_ERROR "${d} = \"${${d}}\" is not the expected working directory (${EXPECTED_WORKING_DIR})") + endif() +endforeach() diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index cef6368..2d94e29 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -115,6 +115,7 @@ run_cmake_command(E_sleep-bad-arg2 ${CMAKE_COMMAND} -E sleep 1 -1) run_cmake_command(E_sleep-one-tenth ${CMAKE_COMMAND} -E sleep 0.1) run_cmake_command(P_directory ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}) +run_cmake_command(P_working-dir ${CMAKE_COMMAND} -DEXPECTED_WORKING_DIR=${RunCMake_BINARY_DIR}/P_working-dir-build -P ${RunCMake_SOURCE_DIR}/P_working-dir.cmake) set(RunCMake_TEST_OPTIONS "-DFOO=-DBAR:BOOL=BAZ") diff --git a/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt b/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt index 3ee1855..f68e38e 100644 --- a/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt +++ b/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt @@ -35,12 +35,12 @@ add_library(hello SHARED hello.f) add_library(world SHARED world.f) target_link_libraries(hello world) if(CMAKE_Fortran_COMPILER_ID MATCHES SunPro) - target_link_libraries(hello fsu) + target_link_libraries(hello PRIVATE fsu) if(CMAKE_Fortran_PLATFORM_ID MATCHES SunOS) - target_link_libraries(hello sunmath m) + target_link_libraries(hello PRIVATE sunmath m) test_sunquad(CMAKE_HAS_SUNQUAD) if(CMAKE_HAS_SUNQUAD) - target_link_libraries(hello sunquad) + target_link_libraries(hello PRIVATE sunquad) endif() endif() endif() diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt index 8357d5f..ae82755 100644 --- a/Tests/VSWinStorePhone/CMakeLists.txt +++ b/Tests/VSWinStorePhone/CMakeLists.txt @@ -1,7 +1,8 @@ cmake_minimum_required(VERSION 3.0) project(VSWinStorePhone) - -if(MSVC_VERSION GREATER 1700) +if(MSVC_VERSION GREATER 1899) + set(COMPILER_VERSION "14") +elseif(MSVC_VERSION GREATER 1700) set(COMPILER_VERSION "12") elseif(MSVC_VERSION GREATER 1600) set(COMPILER_VERSION "11") @@ -91,6 +92,7 @@ elseif (NOT "${PLATFORM}" STREQUAL "DESKTOP") set(ASSET_FILES ${ASSET_FILES} Direct3DApp1/Assets/Logo.png Direct3DApp1/Assets/SmallLogo.png + Direct3DApp1/Assets/SmallLogo44x44.png Direct3DApp1/Assets/SplashScreen.png Direct3DApp1/Assets/StoreLogo.png ) @@ -124,4 +126,15 @@ source_group("Resource Files" FILES ${RESOURCE_FILES}) add_executable(${EXE_NAME} WIN32 ${SOURCE_FILES} ${HEADER_FILES} ${RESOURCE_FILES}) set_property(TARGET ${EXE_NAME} PROPERTY VS_WINRT_COMPONENT TRUE) + +string(SUBSTRING "${CMAKE_SYSTEM_VERSION}" 0, 4, SHORT_VERSION) + +if("${SHORT_VERSION}" STREQUAL "10.0") + message(STATUS "Targeting Windows 10. Setting Extensions to version ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + set_property(TARGET ${EXE_NAME} PROPERTY VS_DESKTOP_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + set_property(TARGET ${EXE_NAME} PROPERTY VS_MOBILE_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + set_property(TARGET ${EXE_NAME} PROPERTY VS_IOT_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") +endif() + + target_link_libraries(${EXE_NAME} d3d11) diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo44x44.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo44x44.png Binary files differnew file mode 100644 index 0000000..28810b7 --- /dev/null +++ b/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo44x44.png diff --git a/Tests/VSWinStorePhone/cmake/Package_vc14.store.appxmanifest.in b/Tests/VSWinStorePhone/cmake/Package_vc14.store.appxmanifest.in new file mode 100644 index 0000000..6b27ab7 --- /dev/null +++ b/Tests/VSWinStorePhone/cmake/Package_vc14.store.appxmanifest.in @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<Package + xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" + xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" + xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" + IgnorableNamespaces="uap mp"> + + <Identity Name="@PACKAGE_GUID@" Publisher="CN=mgong" Version="1.1.0.0" /> + <mp:PhoneIdentity PhoneProductId="@PACKAGE_GUID@" PhonePublisherId="00000000-0000-0000-0000-000000000000"/> + + <Properties> + <DisplayName>@SHORT_NAME@</DisplayName> + <PublisherDisplayName>mgong</PublisherDisplayName> + <Logo>Assets/StoreLogo.png</Logo> + </Properties> + + <Dependencies> + <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.65535.65535" /> + </Dependencies> + + <Resources> + <Resource Language="x-generate" /> + </Resources> + <Applications> + <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="@SHORT_NAME@.App"> + <uap:VisualElements + DisplayName="@SHORT_NAME@" + Description="@SHORT_NAME@" + BackgroundColor="#336699" + Square150x150Logo="Assets/Logo.png" + Square44x44Logo="Assets/SmallLogo44x44.png"> + <uap:SplashScreen Image="Assets/SplashScreen.png" /> + </uap:VisualElements> + </Application> + </Applications> +</Package> diff --git a/Utilities/Release/create-cmake-release.cmake b/Utilities/Release/create-cmake-release.cmake index 4cfa2ed..76057d1 100644 --- a/Utilities/Release/create-cmake-release.cmake +++ b/Utilities/Release/create-cmake-release.cmake @@ -7,8 +7,7 @@ file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/logs) set(RELEASE_SCRIPTS_BATCH_1 dash2win64_release.cmake # Windows - dashmacmini2_release.cmake # Mac Darwin universal ppc;i386 - dashmacmini5_release.cmake # Mac Darwin64 universal x86_64;i386 + dashmacmini5_release.cmake # OS X x86_64 magrathea_release.cmake # Linux linux64_release.cmake # Linux x86_64 ) diff --git a/Utilities/Release/dash2win64_cygwin.cmake b/Utilities/Release/dash2win64_cygwin.cmake index c0cd761..ca590ed 100644 --- a/Utilities/Release/dash2win64_cygwin.cmake +++ b/Utilities/Release/dash2win64_cygwin.cmake @@ -28,4 +28,6 @@ get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) # allows us to produce cygwin builds in the short term. set(EXTRA_CTEST_ARGS "-E ExternalProject") +set(LOCAL_DIR cygwin) + include(${path}/release_cmake.cmake) diff --git a/Utilities/Release/dash2win64_release.cmake b/Utilities/Release/dash2win64_release.cmake index 25acc17..ecfd7c5 100644 --- a/Utilities/Release/dash2win64_release.cmake +++ b/Utilities/Release/dash2win64_release.cmake @@ -1,6 +1,6 @@ set(CMAKE_RELEASE_DIRECTORY "c:/cygwin/home/dashboard/CMakeReleaseDirectory") set(CONFIGURE_WITH_CMAKE TRUE) -set(CMAKE_CONFIGURE_PATH "c:/Program\\ Files\\ \\(x86\\)/CMake\\ 2.8/bin/cmake.exe") +set(CMAKE_CONFIGURE_PATH "c:/Program\\ Files\\ \\(x86\\)/CMake/bin/cmake.exe") set(PROCESSORS 8) set(HOST dash2win64) set(CPACK_BINARY_GENERATORS "NSIS ZIP") diff --git a/Utilities/Release/dashmacmini2_release.cmake b/Utilities/Release/dashmacmini2_release.cmake deleted file mode 100644 index cd4c5a1..0000000 --- a/Utilities/Release/dashmacmini2_release.cmake +++ /dev/null @@ -1,25 +0,0 @@ -set(PROCESSORS 2) -set(CMAKE_RELEASE_DIRECTORY /Users/kitware/CMakeReleaseDirectory) -set(USER_OVERRIDE "set(CMAKE_CXX_LINK_EXECUTABLE \\\"gcc <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -shared-libgcc -lstdc++-static\\\")") -set(BOOTSTRAP_ARGS "--prefix=/ --docdir=doc/cmake") -set(HOST dashmacmini2) -set(MAKE_PROGRAM "make") -set(MAKE "${MAKE_PROGRAM} -j2") -set(CPACK_BINARY_GENERATORS "DragNDrop TGZ TZ") -set(CPACK_DMG_FORMAT "UDBZ") #build using bzip2 for smaller package size -set(INITIAL_CACHE " -CMAKE_BUILD_TYPE:STRING=Release -CMAKE_OSX_ARCHITECTURES:STRING=ppc;i386 -CMAKE_USE_OPENSSL:BOOL=ON -OPENSSL_CRYPTO_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1g-install/lib/libcrypto.a -OPENSSL_INCLUDE_DIR:PATH=/Users/kitware/openssl-1.0.1g-install/include -OPENSSL_SSL_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1g-install/lib/libssl.a -CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE -CPACK_SYSTEM_NAME:STRING=Darwin-universal -BUILD_QtDialog:BOOL=TRUE -CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE -CMake_INSTALL_DEPENDENCIES:BOOL=ON -QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Support/qt-4.8.0/install/bin/qmake -") -get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) -include(${path}/release_cmake.cmake) diff --git a/Utilities/Release/release_cmake.cmake b/Utilities/Release/release_cmake.cmake index 4c4dd8a..c50602d 100644 --- a/Utilities/Release/release_cmake.cmake +++ b/Utilities/Release/release_cmake.cmake @@ -119,27 +119,34 @@ foreach(gen ${generators}) set(SUFFIXES ${SUFFIXES} "*.exe") endif() endforeach() + +if(LOCAL_DIR) + file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${LOCAL_DIR}") +else() + set(LOCAL_DIR .) +endif() + # copy all the files over from the remote machine set(PROJECT_PREFIX cmake-) foreach(suffix ${SUFFIXES}) - message("scp ${HOST}:${FINAL_PATH}/${PROJECT_PREFIX}${suffix} .") + message("scp ${HOST}:${FINAL_PATH}/${PROJECT_PREFIX}${suffix} ${LOCAL_DIR}") execute_process(COMMAND - scp ${HOST}:${FINAL_PATH}/${PROJECT_PREFIX}${suffix} . + scp ${HOST}:${FINAL_PATH}/${PROJECT_PREFIX}${suffix} ${LOCAL_DIR} RESULT_VARIABLE result) if(${result} GREATER 0) - message("error getting file back scp ${HOST}:${FINAL_PATH}/${PROJECT_PREFIX}${suffix} .") + message("error getting file back scp ${HOST}:${FINAL_PATH}/${PROJECT_PREFIX}${suffix} ${LOCAL_DIR}") endif() endforeach() # if there are extra files to copy get them as well if(extra_files) foreach(f ${extra_files}) - message("scp ${HOST}:${FINAL_PATH}/${f} .") + message("scp ${HOST}:${FINAL_PATH}/${f} ${LOCAL_DIR}") execute_process(COMMAND - scp ${HOST}:${FINAL_PATH}/${f} . + scp ${HOST}:${FINAL_PATH}/${f} ${LOCAL_DIR} RESULT_VARIABLE result) if(${result} GREATER 0) - message("error getting file back scp ${HOST}:${FINAL_PATH}/${f} .") + message("error getting file back scp ${HOST}:${FINAL_PATH}/${f} ${LOCAL_DIR}") endif() endforeach() endif() diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake index ac41300..171811a 100644 --- a/Utilities/Release/upload_release.cmake +++ b/Utilities/Release/upload_release.cmake @@ -1,6 +1,6 @@ set(CTEST_RUN_CURRENT_SCRIPT 0) if(NOT VERSION) - set(VERSION 3.3) + set(VERSION 3.4) endif() if(NOT DEFINED PROJECT_PREFIX) set(PROJECT_PREFIX cmake-${VERSION}) @@ -572,7 +572,7 @@ cmake_try_run () echo "Test produced non-zero return code" return 3 fi - echo "Test succeded" + echo "Test succeeded" return 0 } |