diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index e50ae7b95..08ac4905e 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -177,7 +177,7 @@ the indentation. Otherwise it retains the same position on the line" (interactive) (save-excursion (goto-char (point-min)) - (while (re-search-forward "^\\([ \t]*\\)\\(\\w+\\)\\([ \t]*(\\)" nil t) + (while (re-search-forward "^\\([ \t]*\\)\\_<\\(\\(?:\\w\\|\\s_\\)+\\)\\_>\\([ \t]*(\\)" nil t) (replace-match (concat (match-string 1) diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index b6013efdd..ae006536d 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -183,6 +183,13 @@ if("${CPACK_GENERATOR}" STREQUAL "PackageMaker") endif() endif() +if("${CPACK_GENERATOR}" STREQUAL "DragNDrop") + set(CPACK_DMG_BACKGROUND_IMAGE + "@CMake_SOURCE_DIR@/Packaging/CMakeDMGBackground.tif") + set(CPACK_DMG_DS_STORE_SETUP_SCRIPT + "@CMake_SOURCE_DIR@/Packaging/CMakeDMGSetup.scpt") +endif() + if("${CPACK_GENERATOR}" STREQUAL "WIX") # Reset CPACK_PACKAGE_VERSION to deal with WiX restriction. # But the file names still use the full CMake_VERSION value: diff --git a/CMakeLists.txt b/CMakeLists.txt index c96f68bcd..ebee14b66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -372,12 +372,14 @@ macro (CMAKE_BUILD_UTILITIES) set(ENABLE_LZMA ON CACHE INTERNAL "Enable the use of the system found LZMA library if found") set(ENABLE_ZLIB ON CACHE INTERNAL "Enable the use of the system found ZLIB library if found") set(ENABLE_BZip2 ON CACHE INTERNAL "Enable the use of the system found BZip2 library if found") + set(ENABLE_LIBXML2 OFF CACHE INTERNAL "Enable the use of the system found libxml2 library if found") set(ENABLE_EXPAT OFF CACHE INTERNAL "Enable the use of the system found EXPAT library if found") set(ENABLE_PCREPOSIX OFF CACHE INTERNAL "Enable the use of the system found PCREPOSIX library if found") set(ENABLE_LibGCC OFF CACHE INTERNAL "Enable the use of the system found LibGCC library if found") set(ENABLE_XATTR OFF CACHE INTERNAL "Enable extended attribute support") set(ENABLE_ACL OFF CACHE INTERNAL "Enable ACL support") set(ENABLE_ICONV OFF CACHE INTERNAL "Enable iconv support") + set(ENABLE_CNG OFF CACHE INTERNAL "Enable the use of CNG(Crypto Next Generation)") add_subdirectory(Utilities/cmlibarchive) CMAKE_SET_TARGET_FOLDER(cmlibarchive "Utilities/3rdParty") set(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES}) diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt index 4207db406..977264c7d 100644 --- a/Help/manual/OPTIONS_BUILD.txt +++ b/Help/manual/OPTIONS_BUILD.txt @@ -77,10 +77,23 @@ Suppress developer warnings. Suppress warnings that are meant for the author of the - CMakeLists.txt files. + CMakeLists.txt files. By default this will also turn off + deprecation warnings. ``-Wdev`` Enable developer warnings. Enable warnings that are meant for the author of the CMakeLists.txt - files. + files. By default this will also turn on deprecation warnings. + +``-Wdeprecated`` + Enable deprecated functionality warnings. + + Enable warnings for usage of deprecated functionality, that are meant + for the author of the CMakeLists.txt files. + +``-Wno-deprecated`` + Suppress deprecated functionality warnings. + + Suppress warnings for usage of deprecated functionality, that are meant + for the author of the CMakeLists.txt files. diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index bc633e6ec..4a04f3145 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -95,15 +95,18 @@ Apple Frameworks """""""""""""""" A ``SHARED`` library may be marked with the :prop_tgt:`FRAMEWORK` -target property to create an OS X Framework: +target property to create an OS X or iOS Framework Bundle. +The ``MACOSX_FRAMEWORK_IDENTIFIER`` sets ``CFBundleIdentifier`` key +and it uniquely identifies the bundle. .. code-block:: cmake add_library(MyFramework SHARED MyFramework.cpp) set_target_properties(MyFramework PROPERTIES - FRAMEWORK 1 + FRAMEWORK TRUE FRAMEWORK_VERSION A - ) + MACOSX_FRAMEWORK_IDENTIFIER org.cmake.MyFramework + ) .. _`Object Libraries`: diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst index 492fcac39..7b294a87d 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -151,6 +151,36 @@ target system prefixes, whereas executables which must be run as part of the bui should be found only on the host and not on the target. This is the purpose of the ``CMAKE_FIND_ROOT_PATH_MODE_*`` variables. +.. _`Cray Cross-Compile`: + +Cross Compiling for the Cray Linux Environment +---------------------------------------------- + +Cross compiling for compute nodes in the Cray Linux Environment can be done +without needing a separate toolchain file. Specifying +``-DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment`` on the CMake command line will +ensure that the appropriate build settings and search paths are configured. +The platform will pull its configuration from the current environment +variables and will configure a project to use the compiler wrappers from the +Cray Programming Environment's ``PrgEnv-*`` modules if present and loaded. + +The default configuration of the Cray Programming Environment is to only +support static libraries. This can be overridden and shared libraries +enabled by setting the ``CRAYPE_LINK_TYPE`` environment variable to +``dynamic``. + +Running CMake without specifying :variable:`CMAKE_SYSTEM_NAME` will +run the configure step in host mode assuming a standard Linux environment. +If not overridden, the ``PrgEnv-*`` compiler wrappers will end up getting used, +which if targeting the either the login node or compute node, is likely not the +desired behavior. The exception to this would be if you are building directly +on a NID instead of cross-compiling from a login node. If trying to build +software for a login node, you will need to either first unload the +currently loaded ``PrgEnv-*`` module or explicitly tell CMake to use the +system compilers in ``/usr/bin`` instead of the Cray wrappers. If instead +targeting a compute node is desired, just specify the +:variable:`CMAKE_SYSTEM_NAME` as mentioned above. + Cross Compiling using Clang --------------------------- diff --git a/Help/prop_dir/CLEAN_NO_CUSTOM.rst b/Help/prop_dir/CLEAN_NO_CUSTOM.rst index 9a4173e81..5ae78bf75 100644 --- a/Help/prop_dir/CLEAN_NO_CUSTOM.rst +++ b/Help/prop_dir/CLEAN_NO_CUSTOM.rst @@ -1,7 +1,6 @@ CLEAN_NO_CUSTOM --------------- -Should the output of custom commands be left. - -If this is true then the outputs of custom commands for this directory -will not be removed during the "make clean" stage. +Set to true to tell :ref:`Makefile Generators` not to remove the outputs of +custom commands for this directory during the ``make clean`` operation. +This is ignored on other generators because it is not possible to implement. diff --git a/Help/prop_sf/MACOSX_PACKAGE_LOCATION.rst b/Help/prop_sf/MACOSX_PACKAGE_LOCATION.rst index 27f292961..69cdcb7ff 100644 --- a/Help/prop_sf/MACOSX_PACKAGE_LOCATION.rst +++ b/Help/prop_sf/MACOSX_PACKAGE_LOCATION.rst @@ -1,19 +1,23 @@ MACOSX_PACKAGE_LOCATION ----------------------- -Place a source file inside a Mac OS X bundle, CFBundle, or framework. +Place a source file inside a Application Bundle +(:prop_tgt:`MACOSX_BUNDLE`), Core Foundation Bundle (:prop_tgt:`BUNDLE`), +or Framework Bundle (:prop_tgt:`FRAMEWORK`). It is applicable for OS X +and iOS. -Executable targets with the MACOSX_BUNDLE property set are built as -Mac OS X application bundles on Apple platforms. Shared library -targets with the FRAMEWORK property set are built as Mac OS X -frameworks on Apple platforms. Module library targets with the BUNDLE -property set are built as Mac OS X CFBundle bundles on Apple -platforms. Source files listed in the target with this property set -will be copied to a directory inside the bundle or framework content -folder specified by the property value. For bundles the content -folder is ".app/Contents". For frameworks the content folder is -".framework/Versions/". For cfbundles the content -folder is ".bundle/Contents" (unless the extension is changed). -See the PUBLIC_HEADER, PRIVATE_HEADER, and RESOURCE target properties -for specifying files meant for Headers, PrivateHeaders, or Resources -directories. +Executable targets with the :prop_tgt:`MACOSX_BUNDLE` property set are +built as OS X or iOS application bundles on Apple platforms. Shared +library targets with the :prop_tgt:`FRAMEWORK` property set are built as +OS X or iOS frameworks on Apple platforms. Module library targets with +the :prop_tgt:`BUNDLE` property set are built as OS X ``CFBundle`` bundles +on Apple platforms. Source files listed in the target with this property +set will be copied to a directory inside the bundle or framework content +folder specified by the property value. For OS X Application Bundles the +content folder is ``.app/Contents``. For OS X Frameworks the +content folder is ``.framework/Versions/``. For OS X +CFBundles the content folder is ``.bundle/Contents`` (unless the +extension is changed). See the :prop_tgt:`PUBLIC_HEADER`, +:prop_tgt:`PRIVATE_HEADER`, and :prop_tgt:`RESOURCE` target properties for +specifying files meant for ``Headers``, ``PrivateHeaders``, or +``Resources`` directories. diff --git a/Help/prop_tgt/BUNDLE.rst b/Help/prop_tgt/BUNDLE.rst index 166659fb2..075f017df 100644 --- a/Help/prop_tgt/BUNDLE.rst +++ b/Help/prop_tgt/BUNDLE.rst @@ -1,9 +1,9 @@ BUNDLE ------ -This target is a CFBundle on the Mac. +This target is a ``CFBundle`` on the OS X. If a module library target has this property set to true it will be -built as a CFBundle when built on the mac. It will have the directory -structure required for a CFBundle and will be suitable to be used for +built as a ``CFBundle`` when built on the mac. It will have the directory +structure required for a ``CFBundle`` and will be suitable to be used for creating Browser Plugins or other application resources. diff --git a/Help/prop_tgt/BUNDLE_EXTENSION.rst b/Help/prop_tgt/BUNDLE_EXTENSION.rst index 94ac935bc..ea265b373 100644 --- a/Help/prop_tgt/BUNDLE_EXTENSION.rst +++ b/Help/prop_tgt/BUNDLE_EXTENSION.rst @@ -1,7 +1,7 @@ BUNDLE_EXTENSION ---------------- -The file extension used to name a BUNDLE target on the Mac. +The file extension used to name a :prop_tgt:`BUNDLE` target on the OS X and iOS. -The default value is "bundle" - you can also use "plugin" or whatever +The default value is ``bundle`` - you can also use ``plugin`` or whatever file extension is required by the host app for your bundle. diff --git a/Help/prop_tgt/ENABLE_EXPORTS.rst b/Help/prop_tgt/ENABLE_EXPORTS.rst index dfd4af754..9e2230971 100644 --- a/Help/prop_tgt/ENABLE_EXPORTS.rst +++ b/Help/prop_tgt/ENABLE_EXPORTS.rst @@ -12,9 +12,9 @@ dependency on the executable is created for targets that link to it. For DLL platforms an import library will be created for the exported symbols and then used for linking. All Windows-based systems including Cygwin are DLL platforms. For non-DLL platforms that -require all symbols to be resolved at link time, such as Mac OS X, the +require all symbols to be resolved at link time, such as OS X, the module will "link" to the executable using a flag like -"-bundle_loader". For other non-DLL platforms the link rule is simply +``-bundle_loader``. For other non-DLL platforms the link rule is simply ignored since the dynamic loader will automatically bind symbols when the module is loaded. diff --git a/Help/prop_tgt/FRAMEWORK.rst b/Help/prop_tgt/FRAMEWORK.rst index dcb6d3b97..6c212c3d0 100644 --- a/Help/prop_tgt/FRAMEWORK.rst +++ b/Help/prop_tgt/FRAMEWORK.rst @@ -1,11 +1,31 @@ FRAMEWORK --------- -This target is a framework on the Mac. +Build ``SHARED`` library as Framework Bundle on the OS X and iOS. -If a shared library target has this property set to true it will be -built as a framework when built on the mac. It will have the +If a ``SHARED`` library target has this property set to ``TRUE`` it will be +built as a framework when built on the OS X and iOS. It will have the directory structure required for a framework and will be suitable to be used with the ``-framework`` option -See also the :prop_tgt:`FRAMEWORK_VERSION` target property. +To customize ``Info.plist`` file in the framework, use +:prop_tgt:`MACOSX_FRAMEWORK_INFO_PLIST` target property. + +For OS X see also the :prop_tgt:`FRAMEWORK_VERSION` target property. + +Example of creation ``dynamicFramework``: + +.. code-block:: cmake + + add_library(dynamicFramework SHARED + dynamicFramework.c + dynamicFramework.h + ) + set_target_properties(dynamicFramework PROPERTIES + FRAMEWORK TRUE + FRAMEWORK_VERSION C + MACOSX_FRAMEWORK_IDENTIFIER com.cmake.dynamicFramework + MACOSX_FRAMEWORK_INFO_PLIST Info.plist + PUBLIC_HEADER dynamicFramework.h + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer" + ) diff --git a/Help/prop_tgt/FRAMEWORK_VERSION.rst b/Help/prop_tgt/FRAMEWORK_VERSION.rst index bf650a7ff..6aa30268a 100644 --- a/Help/prop_tgt/FRAMEWORK_VERSION.rst +++ b/Help/prop_tgt/FRAMEWORK_VERSION.rst @@ -3,3 +3,6 @@ FRAMEWORK_VERSION Version of a framework created using the :prop_tgt:`FRAMEWORK` target property (e.g. ``A``). + +This property only affects OS X, as iOS doesn't have versioned +directory structure. diff --git a/Help/prop_tgt/MACOSX_BUNDLE.rst b/Help/prop_tgt/MACOSX_BUNDLE.rst index ff21e6147..8d7d91416 100644 --- a/Help/prop_tgt/MACOSX_BUNDLE.rst +++ b/Help/prop_tgt/MACOSX_BUNDLE.rst @@ -1,12 +1,12 @@ MACOSX_BUNDLE ------------- -Build an executable as an application bundle on Mac OS X. +Build an executable as an Application Bundle on OS X or iOS. -When this property is set to true the executable when built on Mac OS -X will be created as an application bundle. This makes it a GUI -executable that can be launched from the Finder. See the -MACOSX_BUNDLE_INFO_PLIST target property for information about -creation of the Info.plist file for the application bundle. This -property is initialized by the value of the variable -CMAKE_MACOSX_BUNDLE if it is set when a target is created. +When this property is set to true the executable when built on OS X +or iOS will be created as an application bundle. This makes it +a GUI executable that can be launched from the Finder. See the +:prop_tgt:`MACOSX_FRAMEWORK_INFO_PLIST` target property for information about +creation of the ``Info.plist`` file for the application bundle. +This property is initialized by the value of the variable +:variable:`CMAKE_MACOSX_BUNDLE` if it is set when a target is created. diff --git a/Help/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.rst b/Help/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.rst index 07a933faf..8515accc2 100644 --- a/Help/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.rst +++ b/Help/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.rst @@ -1,10 +1,10 @@ MACOSX_BUNDLE_INFO_PLIST ------------------------ -Specify a custom ``Info.plist`` template for a Mac OS X App Bundle. +Specify a custom ``Info.plist`` template for a OS X and iOS Application Bundle. An executable target with :prop_tgt:`MACOSX_BUNDLE` enabled will be built as an -application bundle on Mac OS X. By default its ``Info.plist`` file is created +application bundle on OS X. By default its ``Info.plist`` file is created by configuring a template called ``MacOSXBundleInfo.plist.in`` located in the :variable:`CMAKE_MODULE_PATH`. This property specifies an alternative template file name which may be a full path. diff --git a/Help/prop_tgt/MACOSX_FRAMEWORK_INFO_PLIST.rst b/Help/prop_tgt/MACOSX_FRAMEWORK_INFO_PLIST.rst index 548c3ac64..58f31d495 100644 --- a/Help/prop_tgt/MACOSX_FRAMEWORK_INFO_PLIST.rst +++ b/Help/prop_tgt/MACOSX_FRAMEWORK_INFO_PLIST.rst @@ -1,10 +1,10 @@ MACOSX_FRAMEWORK_INFO_PLIST --------------------------- -Specify a custom ``Info.plist`` template for a Mac OS X Framework. +Specify a custom ``Info.plist`` template for a OS X and iOS Framework. A library target with :prop_tgt:`FRAMEWORK` enabled will be built as a -framework on Mac OS X. By default its ``Info.plist`` file is created by +framework on OS X. By default its ``Info.plist`` file is created by configuring a template called ``MacOSXFrameworkInfo.plist.in`` located in the :variable:`CMAKE_MODULE_PATH`. This property specifies an alternative template file name which may be a full path. diff --git a/Help/prop_tgt/MACOSX_RPATH.rst b/Help/prop_tgt/MACOSX_RPATH.rst index d3934bae2..41bb8cc09 100644 --- a/Help/prop_tgt/MACOSX_RPATH.rst +++ b/Help/prop_tgt/MACOSX_RPATH.rst @@ -1,18 +1,23 @@ MACOSX_RPATH ------------ -Whether to use rpaths on Mac OS X. +Whether this target on OS X or iOS is located at runtime using rpaths. When this property is set to true, the directory portion of -the "install_name" field of shared libraries will be ``@rpath`` -unless overridden by :prop_tgt:`INSTALL_NAME_DIR`. Runtime -paths will also be embedded in binaries using this target and -can be controlled by the :prop_tgt:`INSTALL_RPATH` target property. +the "install_name" field of this shared library will be ``@rpath`` +unless overridden by :prop_tgt:`INSTALL_NAME_DIR`. This indicates +the shared library is to be found at runtime using runtime +paths (rpaths). + This property is initialized by the value of the variable :variable:`CMAKE_MACOSX_RPATH` if it is set when a target is created. -Policy CMP0042 was introduced to change the default value of -MACOSX_RPATH to ON. This is because use of ``@rpath`` is a +Runtime paths will also be embedded in binaries using this target and +can be controlled by the :prop_tgt:`INSTALL_RPATH` target property on +the target linking to this target. + +Policy :policy:`CMP0042` was introduced to change the default value of +``MACOSX_RPATH`` to ``TRUE. This is because use of ``@rpath`` is a more flexible and powerful alternative to ``@executable_path`` and ``@loader_path``. diff --git a/Help/prop_tgt/OSX_ARCHITECTURES_CONFIG.rst b/Help/prop_tgt/OSX_ARCHITECTURES_CONFIG.rst index f8fdcff6f..fb78177fb 100644 --- a/Help/prop_tgt/OSX_ARCHITECTURES_CONFIG.rst +++ b/Help/prop_tgt/OSX_ARCHITECTURES_CONFIG.rst @@ -1,7 +1,7 @@ OSX_ARCHITECTURES_ -------------------------- -Per-configuration OS X binary architectures for a target. +Per-configuration OS X and iOS binary architectures for a target. This property is the configuration-specific version of :prop_tgt:`OSX_ARCHITECTURES`. diff --git a/Help/prop_tgt/PRIVATE_HEADER.rst b/Help/prop_tgt/PRIVATE_HEADER.rst index da2127b18..c4412ed25 100644 --- a/Help/prop_tgt/PRIVATE_HEADER.rst +++ b/Help/prop_tgt/PRIVATE_HEADER.rst @@ -1,11 +1,11 @@ PRIVATE_HEADER -------------- -Specify private header files in a FRAMEWORK shared library target. +Specify private header files in a :prop_tgt:`FRAMEWORK` shared library target. -Shared library targets marked with the FRAMEWORK property generate -frameworks on OS X and normal shared libraries on other platforms. +Shared library targets marked with the :prop_tgt:`FRAMEWORK` property generate +frameworks on OS X, iOS and normal shared libraries on other platforms. This property may be set to a list of header files to be placed in the PrivateHeaders directory inside the framework folder. On non-Apple -platforms these headers may be installed using the PRIVATE_HEADER -option to the install(TARGETS) command. +platforms these headers may be installed using the ``PRIVATE_HEADER`` +option to the ``install(TARGETS)`` command. diff --git a/Help/prop_tgt/PUBLIC_HEADER.rst b/Help/prop_tgt/PUBLIC_HEADER.rst index 6e25d94d5..d4a636caf 100644 --- a/Help/prop_tgt/PUBLIC_HEADER.rst +++ b/Help/prop_tgt/PUBLIC_HEADER.rst @@ -1,11 +1,11 @@ PUBLIC_HEADER ------------- -Specify public header files in a FRAMEWORK shared library target. +Specify public header files in a :prop_tgt:`FRAMEWORK` shared library target. -Shared library targets marked with the FRAMEWORK property generate -frameworks on OS X and normal shared libraries on other platforms. +Shared library targets marked with the :prop_tgt:`FRAMEWORK` property generate +frameworks on OS X, iOS and normal shared libraries on other platforms. This property may be set to a list of header files to be placed in the -Headers directory inside the framework folder. On non-Apple platforms -these headers may be installed using the PUBLIC_HEADER option to the -install(TARGETS) command. +``Headers`` directory inside the framework folder. On non-Apple platforms +these headers may be installed using the ``PUBLIC_HEADER`` option to the +``install(TARGETS)`` command. diff --git a/Help/prop_tgt/RESOURCE.rst b/Help/prop_tgt/RESOURCE.rst index 1e9921de3..5dad3ea1c 100644 --- a/Help/prop_tgt/RESOURCE.rst +++ b/Help/prop_tgt/RESOURCE.rst @@ -1,11 +1,11 @@ RESOURCE -------- -Specify resource files in a FRAMEWORK shared library target. +Specify resource files in a :prop_tgt:`FRAMEWORK` shared library target. -Shared library targets marked with the FRAMEWORK property generate -frameworks on OS X and normal shared libraries on other platforms. +Shared library targets marked with the :prop_tgt:`FRAMEWORK` property generate +frameworks on OS X, iOS and normal shared libraries on other platforms. This property may be set to a list of files to be placed in the -Resources directory inside the framework folder. On non-Apple -platforms these files may be installed using the RESOURCE option to -the install(TARGETS) command. +``Resources`` directory inside the framework folder. On non-Apple +platforms these files may be installed using the ``RESOURCE`` option to +the ``install(TARGETS)`` command. diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst new file mode 100644 index 000000000..e4cc01e23 --- /dev/null +++ b/Help/release/dev/0-sample-topic.rst @@ -0,0 +1,7 @@ +0-sample-topic +-------------- + +* This is a sample release note for the change in a topic. + Developers should add similar notes for each topic branch + making a noteworthy change. Each document should be named + and titled to match the topic name to avoid merge conflicts. diff --git a/Help/release/dev/FindFLEX-DEFINES_FILE.rst b/Help/release/dev/FindFLEX-DEFINES_FILE.rst new file mode 100644 index 000000000..95133aa4a --- /dev/null +++ b/Help/release/dev/FindFLEX-DEFINES_FILE.rst @@ -0,0 +1,6 @@ +FindFLEX-DEFINES_FILE +--------------------- + +* The :module:`FindFLEX` module ``FLEX_TARGET`` macro learned a + new ``DEFINES_FILE`` option to specify a custom output header + to be generated. diff --git a/Help/release/dev/FindGTK2_GTK2_TARGETS.rst b/Help/release/dev/FindGTK2_GTK2_TARGETS.rst new file mode 100644 index 000000000..76e3657af --- /dev/null +++ b/Help/release/dev/FindGTK2_GTK2_TARGETS.rst @@ -0,0 +1,7 @@ +FindGTK2_GTK2_TARGETS +--------------------- + +* The :module:`FindGTK2` module, when ``GTK2_USE_IMPORTED_TARGETS`` is + enabled, now sets ``GTK2_LIBRARIES`` to contain the list of imported + targets instead of the paths to the libraries. Moreover it now sets + a new ``GTK2_TARGETS`` variable containing all the targets imported. 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 000000000..2ba14592b --- /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/FindOpenSSL-msvc-static-rt.rst b/Help/release/dev/FindOpenSSL-msvc-static-rt.rst new file mode 100644 index 000000000..6e0ee276c --- /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/FindXercesC-imported-targets.rst b/Help/release/dev/FindXercesC-imported-targets.rst new file mode 100644 index 000000000..69cec5c4d --- /dev/null +++ b/Help/release/dev/FindXercesC-imported-targets.rst @@ -0,0 +1,4 @@ +FindXercesC-imported-targets +---------------------------- + +* The :module:`FindXercesC` module now provides imported targets. diff --git a/Help/release/dev/add-armcc-toolchain.rst b/Help/release/dev/add-armcc-toolchain.rst new file mode 100644 index 000000000..2cf6414dc --- /dev/null +++ b/Help/release/dev/add-armcc-toolchain.rst @@ -0,0 +1,4 @@ +add-armcc-toolchain +------------------- + +* Support was added for the ARM Compiler (arm.com) with compiler id ``ARMCC``. diff --git a/Help/release/dev/add-cray-linux-platform.rst b/Help/release/dev/add-cray-linux-platform.rst new file mode 100644 index 000000000..700038260 --- /dev/null +++ b/Help/release/dev/add-cray-linux-platform.rst @@ -0,0 +1,7 @@ +add-cray-linux-platform +----------------------- + +* A new platform file for cross-compiling in the Cray Linux Environment to + target compute nodes was added. See + :ref:`Cross Compiling for the Cray Linux Environment ` + for usage details. diff --git a/Help/release/dev/better-looking-mac-packages.rst b/Help/release/dev/better-looking-mac-packages.rst new file mode 100644 index 000000000..ef1b8e88f --- /dev/null +++ b/Help/release/dev/better-looking-mac-packages.rst @@ -0,0 +1,8 @@ +better-looking-mac-packages +--------------------------- + +* The :module:`CPackDMG` module learned new variable to specify AppleScript + file run to customize appearance of ``DragNDrop`` installer folder, + including background image setting using supplied PNG or multi-resolution + TIFF file. See the :variable:`CPACK_DMG_DS_STORE_SETUP_SCRIPT` and + :variable:`CPACK_DMG_BACKGROUND_IMAGE` variables. diff --git a/Help/release/dev/cmake-W-options.rst b/Help/release/dev/cmake-W-options.rst new file mode 100644 index 000000000..57d375f5d --- /dev/null +++ b/Help/release/dev/cmake-W-options.rst @@ -0,0 +1,12 @@ +cmake-W-options +--------------- + +* The :variable:`CMAKE_WARN_DEPRECATED` variable can now be set using the + ``-Wdeprecated`` and ``-Wno-deprecated`` :manual:`cmake(1)` options. + +* The ``-Wdev`` and ``-Wno-dev`` :manual:`cmake(1)` options now also enable + and suppress the deprecated warnings output by default. + +* Warnings about deprecated functionality are now enabled by default. + They may be suppressed with ``-Wno-deprecated`` or by setting the + :variable:`CMAKE_WARN_DEPRECATED` variable to false. diff --git a/Help/release/dev/cmake-gui-select-toolset.rst b/Help/release/dev/cmake-gui-select-toolset.rst new file mode 100644 index 000000000..5186f910c --- /dev/null +++ b/Help/release/dev/cmake-gui-select-toolset.rst @@ -0,0 +1,6 @@ +cmake-gui-select-toolset +------------------------ + +* The :manual:`cmake-gui(1)` learned an option to set the toolset + to be used with VS IDE and Xcode generators, much like the + existing ``-T`` option to :manual:`cmake(1)`. diff --git a/Help/release/dev/cpack-deb-config-file-source-field.rst b/Help/release/dev/cpack-deb-config-file-source-field.rst new file mode 100644 index 000000000..bbc2aa6ab --- /dev/null +++ b/Help/release/dev/cpack-deb-config-file-source-field.rst @@ -0,0 +1,6 @@ +cpack-deb-config-file-source-field +---------------------------------- + +* The :module:`CPackDeb` module learned to set optional config + file ``Source`` field - monolithic and per-component variable. + See :variable:`CPACK_DEBIAN_PACKAGE_SOURCE`. diff --git a/Help/release/dev/cpack-deb-new-component-vars.rst b/Help/release/dev/cpack-deb-new-component-vars.rst new file mode 100644 index 000000000..e30afdbc1 --- /dev/null +++ b/Help/release/dev/cpack-deb-new-component-vars.rst @@ -0,0 +1,7 @@ +cpack-deb-new-component-vars +---------------------------- + +* The :module:`CPackDeb` module learned to set Package, Section + and Priority control fields per-component. + See :variable:`CPACK_DEBIAN__PACKAGE_SECTION` + and :variable:`CPACK_DEBIAN__PACKAGE_PRIORITY`. diff --git a/Help/release/dev/cpack-dmg-multilanguage-sla.rst b/Help/release/dev/cpack-dmg-multilanguage-sla.rst new file mode 100644 index 000000000..9e28fa236 --- /dev/null +++ b/Help/release/dev/cpack-dmg-multilanguage-sla.rst @@ -0,0 +1,7 @@ +cpack-dmg-multilanguage-sla +--------------------------- + +* The :module:`CPack DragNDrop generator ` learned to add + multi-lingual SLAs to a DMG which is presented to the user when they try to + mount the DMG. See the :variable:`CPACK_DMG_SLA_LANGUAGES` and + :variable:`CPACK_DMG_SLA_DIR` variables for details. diff --git a/Help/release/dev/cpack-nsis-bitmap.rst b/Help/release/dev/cpack-nsis-bitmap.rst new file mode 100644 index 000000000..c5ccfb546 --- /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/deprecate-CMakeForceCompiler.rst b/Help/release/dev/deprecate-CMakeForceCompiler.rst new file mode 100644 index 000000000..dc6e817b4 --- /dev/null +++ b/Help/release/dev/deprecate-CMakeForceCompiler.rst @@ -0,0 +1,5 @@ +deprecate-CMakeForceCompiler +---------------------------- + +* The :module:`CMakeForceCompiler` module and its macros are now deprecated. + See module documentation for an explanation. diff --git a/Help/release/index.rst b/Help/release/index.rst index 5d1a3f76a..752acbd30 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -5,6 +5,8 @@ CMake Release Notes This file should include the adjacent "dev.txt" file in development versions but not in release versions. +.. include:: dev.txt + Releases ======== diff --git a/Help/variable/APPLE.rst b/Help/variable/APPLE.rst index a8d2429ad..75eecf183 100644 --- a/Help/variable/APPLE.rst +++ b/Help/variable/APPLE.rst @@ -1,6 +1,6 @@ APPLE ----- -``True`` if running on Mac OS X. +``True`` if running on OS X. -Set to ``true`` on Mac OS X. +Set to ``true`` on OS X. diff --git a/Help/variable/CMAKE_BINARY_DIR.rst b/Help/variable/CMAKE_BINARY_DIR.rst index f8dd8ab8d..3b323b7ae 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 cc3b63987..40496b5d9 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 db063a4b7..c1b755a0e 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_ENABLE_EXPORTS.rst b/Help/variable/CMAKE_ENABLE_EXPORTS.rst index 1f9ba6f6c..9a877e7e6 100644 --- a/Help/variable/CMAKE_ENABLE_EXPORTS.rst +++ b/Help/variable/CMAKE_ENABLE_EXPORTS.rst @@ -6,15 +6,15 @@ Specify whether an executable exports symbols for loadable modules. Normally an executable does not export any symbols because it is the final program. It is possible for an executable to export symbols to be used by loadable modules. When this property is set to true CMake -will allow other targets to "link" to the executable with the +will allow other targets to ``link`` to the executable with the :command:`TARGET_LINK_LIBRARIES` command. On all platforms a target-level dependency on the executable is created for targets that link to it. For DLL platforms an import library will be created for the exported symbols and then used for linking. All Windows-based systems including Cygwin are DLL platforms. For non-DLL platforms that -require all symbols to be resolved at link time, such as Mac OS X, the -module will "link" to the executable using a flag like -"-bundle_loader". For other non-DLL platforms the link rule is simply +require all symbols to be resolved at link time, such as OS X, the +module will ``link`` to the executable using a flag like +``-bundle_loader``. For other non-DLL platforms the link rule is simply ignored since the dynamic loader will automatically bind symbols when the module is loaded. diff --git a/Help/variable/CMAKE_ERROR_DEPRECATED.rst b/Help/variable/CMAKE_ERROR_DEPRECATED.rst index 277a4cc11..f3a673827 100644 --- a/Help/variable/CMAKE_ERROR_DEPRECATED.rst +++ b/Help/variable/CMAKE_ERROR_DEPRECATED.rst @@ -1,8 +1,7 @@ CMAKE_ERROR_DEPRECATED ---------------------- -Whether to issue deprecation errors for macros and functions. +Whether to issue errors for deprecated functionality. -If ``TRUE``, this can be used by macros and functions to issue fatal -errors when deprecated macros or functions are used. This variable is -``FALSE`` by default. +If ``TRUE``, use of deprecated functionality will issue fatal errors. +If this variable is not set, CMake behaves as if it were set to ``FALSE``. diff --git a/Help/variable/CMAKE_HOST_SYSTEM_NAME.rst b/Help/variable/CMAKE_HOST_SYSTEM_NAME.rst index e5e6f67ff..c67359272 100644 --- a/Help/variable/CMAKE_HOST_SYSTEM_NAME.rst +++ b/Help/variable/CMAKE_HOST_SYSTEM_NAME.rst @@ -4,5 +4,5 @@ CMAKE_HOST_SYSTEM_NAME Name of the OS CMake is running on. On systems that have the uname command, this variable is set to the -output of ``uname -s``. ``Linux``, ``Windows``, and ``Darwin`` for Mac OS X +output of ``uname -s``. ``Linux``, ``Windows``, and ``Darwin`` for OS X are the values found on the big three operating systems. diff --git a/Help/variable/CMAKE_INSTALL_NAME_DIR.rst b/Help/variable/CMAKE_INSTALL_NAME_DIR.rst index 961d71295..1f2d62bf6 100644 --- a/Help/variable/CMAKE_INSTALL_NAME_DIR.rst +++ b/Help/variable/CMAKE_INSTALL_NAME_DIR.rst @@ -1,7 +1,7 @@ CMAKE_INSTALL_NAME_DIR ---------------------- -Mac OS X directory name for installed targets. +OS X directory name for installed targets. ``CMAKE_INSTALL_NAME_DIR`` is used to initialize the :prop_tgt:`INSTALL_NAME_DIR` property on all targets. See that target diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst index 1c3b134d0..81976a918 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst @@ -11,6 +11,7 @@ include: Absoft = Absoft Fortran (absoft.com) ADSP = Analog VisualDSP++ (analog.com) AppleClang = Apple Clang (apple.com) + ARMCC = ARM Compiler (arm.com) CCur = Concurrent Fortran (ccur.com) Clang = LLVM Clang (clang.llvm.org) Cray = Cray Compiler (cray.com) diff --git a/Help/variable/CMAKE_MACOSX_RPATH.rst b/Help/variable/CMAKE_MACOSX_RPATH.rst index ac897c0f7..042e807f5 100644 --- a/Help/variable/CMAKE_MACOSX_RPATH.rst +++ b/Help/variable/CMAKE_MACOSX_RPATH.rst @@ -1,7 +1,7 @@ CMAKE_MACOSX_RPATH ------------------- -Whether to use rpaths on Mac OS X. +Whether to use rpaths on OS X and iOS. This variable is used to initialize the :prop_tgt:`MACOSX_RPATH` property on all targets. diff --git a/Help/variable/CMAKE_OSX_ARCHITECTURES.rst b/Help/variable/CMAKE_OSX_ARCHITECTURES.rst index b9de51862..93916dd62 100644 --- a/Help/variable/CMAKE_OSX_ARCHITECTURES.rst +++ b/Help/variable/CMAKE_OSX_ARCHITECTURES.rst @@ -1,7 +1,7 @@ CMAKE_OSX_ARCHITECTURES ----------------------- -Target specific architectures for OS X. +Target specific architectures for OS X and iOS. This variable is used to initialize the :prop_tgt:`OSX_ARCHITECTURES` property on each target as it is creaed. See that target property diff --git a/Help/variable/CMAKE_SOURCE_DIR.rst b/Help/variable/CMAKE_SOURCE_DIR.rst index 3df0226dc..416fbe1a8 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_WARN_DEPRECATED.rst b/Help/variable/CMAKE_WARN_DEPRECATED.rst index 662cbd8c7..4a224fa5c 100644 --- a/Help/variable/CMAKE_WARN_DEPRECATED.rst +++ b/Help/variable/CMAKE_WARN_DEPRECATED.rst @@ -1,7 +1,10 @@ CMAKE_WARN_DEPRECATED --------------------- -Whether to issue deprecation warnings for macros and functions. +Whether to issue warnings for deprecated functionality. -If ``TRUE``, this can be used by macros and functions to issue deprecation -warnings. This variable is ``FALSE`` by default. +If not ``FALSE``, use of deprecated functionality will issue warnings. +If this variable is not set, CMake behaves as if it were set to ``TRUE``. + +When running :manual:`cmake(1)`, this option can be enabled with the +``-Wdeprecated`` option, or disabled with the ``-Wno-deprecated`` option. diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index a1bfc70a0..c72e3381f 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -2,7 +2,6 @@ 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/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index b22400780..63f8787c0 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -55,6 +55,7 @@ int main(int argc, char* argv[]) #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; #endif + require += info_language_dialect_default[argc]; (void)argv; return require; } diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index 0d102a11b..d2417aaa4 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -75,10 +75,6 @@ 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 4218a6d12..52e44f6d5 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -2,7 +2,6 @@ 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/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index d46750766..61cd79093 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -49,6 +49,7 @@ int main(int argc, char* argv[]) #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; #endif + require += info_language_dialect_default[argc]; (void)argv; return require; } diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index dad7969df..091627bc3 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -74,10 +74,6 @@ 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/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index 19bcbcc28..cbc005570 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -89,6 +89,7 @@ function(compiler_id_detection outvar lang) MSVC ADSP IAR + ARMCC ) if (lang STREQUAL C) list(APPEND ordered_compilers diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index 25af3e39e..91111d299 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -92,6 +92,10 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_IAR ) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_IAR "IAR Assembler") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS ARMCC) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ARMCC ) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ARMCC "(ARM Compiler)|(ARM Assembler)") + include(CMakeDetermineCompilerId) CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT}) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 2e741004b..81c25090c 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -106,7 +106,6 @@ 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) @@ -533,13 +532,6 @@ 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/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake index 1d8b11018..343ab3fe9 100644 --- a/Modules/CMakeForceCompiler.cmake +++ b/Modules/CMakeForceCompiler.cmake @@ -2,11 +2,17 @@ # CMakeForceCompiler # ------------------ # +# Deprecated. Do not use. # +# The macros provided by this module were once intended for use by +# cross-compiling toolchain files when CMake was not able to automatically +# detect the compiler identification. Since the introduction of this module, +# CMake's compiler identification capabilities have improved and can now be +# taught to recognize any compiler. Furthermore, the suite of information +# CMake detects from a compiler is now too extensive to be provided by +# toolchain files using these macros. # -# This module defines macros intended for use by cross-compiling -# toolchain files when CMake is not able to automatically detect the -# compiler identification. +# ------------------------------------------------------------------------- # # Macro CMAKE_FORCE_C_COMPILER has the following signature: # @@ -64,6 +70,8 @@ # License text for the above reference.) macro(CMAKE_FORCE_C_COMPILER compiler id) + message(DEPRECATION "The CMAKE_FORCE_C_COMPILER macro is deprecated. " + "Instead just set CMAKE_C_COMPILER and allow CMake to identify the compiler.") set(CMAKE_C_COMPILER "${compiler}") set(CMAKE_C_COMPILER_ID_RUN TRUE) set(CMAKE_C_COMPILER_ID ${id}) @@ -76,6 +84,8 @@ macro(CMAKE_FORCE_C_COMPILER compiler id) endmacro() macro(CMAKE_FORCE_CXX_COMPILER compiler id) + message(DEPRECATION "The CMAKE_FORCE_CXX_COMPILER macro is deprecated. " + "Instead just set CMAKE_CXX_COMPILER and allow CMake to identify the compiler.") set(CMAKE_CXX_COMPILER "${compiler}") set(CMAKE_CXX_COMPILER_ID_RUN TRUE) set(CMAKE_CXX_COMPILER_ID ${id}) @@ -88,6 +98,8 @@ macro(CMAKE_FORCE_CXX_COMPILER compiler id) endmacro() macro(CMAKE_FORCE_Fortran_COMPILER compiler id) + message(DEPRECATION "The CMAKE_FORCE_Fortran_COMPILER macro is deprecated. " + "Instead just set CMAKE_Fortran_COMPILER and allow CMake to identify the compiler.") set(CMAKE_Fortran_COMPILER "${compiler}") set(CMAKE_Fortran_COMPILER_ID_RUN TRUE) set(CMAKE_Fortran_COMPILER_ID ${id}) diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 6b984e517..14fdd60d9 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -2,7 +2,6 @@ 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/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 017af91c0..2f7f40ec6 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -47,6 +47,8 @@ # define COMPILER_VERSION_PATCH HEX(__SUNPRO_F90 & 0xF) #elif defined(_CRAYFTN) PRINT *, 'INFO:compiler[Cray]' +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) #elif defined(__G95__) PRINT *, 'INFO:compiler[G95]' # define COMPILER_VERSION_MAJOR DEC(__G95__) diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index aa48df760..79393d330 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -51,10 +51,6 @@ 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/CPack.cmake b/Modules/CPack.cmake index 10644662a..25470384d 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -587,7 +587,7 @@ _cpack_set_default(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}") # set sysroot so SDK tools can be used if(CMAKE_OSX_SYSROOT) - _cpack_set_default(CPACK_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}") + _cpack_set_default(CPACK_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}") endif() if(DEFINED CPACK_COMPONENTS_ALL) diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake index b7a6ba539..e34f8cd1a 100644 --- a/Modules/CPackDMG.cmake +++ b/Modules/CPackDMG.cmake @@ -26,15 +26,56 @@ # Path to a custom DS_Store file. This .DS_Store file e.g. can be used to # specify the Finder window position/geometry and layout (such as hidden # toolbars, placement of the icons etc.). This file has to be generated by -# the Finder (either manually or through OSA-script) using a normal folder +# the Finder (either manually or through AppleScript) using a normal folder # from which the .DS_Store file can then be extracted. # +# .. variable:: CPACK_DMG_DS_STORE_SETUP_SCRIPT +# +# Path to a custom AppleScript file. This AppleScript is used to generate +# a .DS_Store file which specifies the Finder window position/geometry and +# layout (such as hidden toolbars, placement of the icons etc.). +# By specifying a custom AppleScript there is no need to use +# CPACK_DMG_DS_STORE, as the .DS_Store that is generated by the AppleScript +# will be packaged. +# # .. variable:: CPACK_DMG_BACKGROUND_IMAGE # -# Path to a background image file. This file will be used as the background -# for the Finder Window when the disk image is opened. By default no -# background image is set. The background image is applied after applying the -# custom .DS_Store file. +# Path to an image file to be used as the background. This file will be +# copied to .background/background., where ext is the original image file +# extension. The background image is installed into the image before +# CPACK_DMG_DS_STORE_SETUP_SCRIPT is executed or CPACK_DMG_DS_STORE is +# installed. By default no background image is set. +# +# .. variable:: CPACK_DMG_SLA_DIR +# +# Directory where license and menu files for different languages are stored. +# Setting this causes CPack to look for a ``.menu.txt`` and +# ``.license.txt`` file for every language defined in +# ``CPACK_DMG_SLA_LANGUAGES``. If both this variable and +# ``CPACK_RESOURCE_FILE_LICENSE`` are set, CPack will only look for the menu +# files and use the same license file for all languages. +# +# .. variable:: CPACK_DMG_SLA_LANGUAGES +# +# Languages for which a license agreement is provided when mounting the +# generated DMG. A menu file consists of 9 lines of text. The first line is +# is the name of the language itself, uppercase, in English (e.g. German). +# The other lines are translations of the following strings: +# +# - Agree +# - Disagree +# - Print +# - Save... +# - You agree to the terms of the License Agreement when you click the +# "Agree" button. +# - Software License Agreement +# - This text cannot be saved. The disk may be full or locked, or the file +# may be locked. +# - Unable to print. Make sure you have selected a printer. +# +# For every language in this list, CPack will try to find files +# ``.menu.txt`` and ``.license.txt`` in the directory +# specified by the :variable:`CPACK_DMG_SLA_DIR` variable. # # .. variable:: CPACK_COMMAND_HDIUTIL # diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 60e0d1f8f..2aaef6161 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -8,7 +8,7 @@ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # # CPackDeb may be used to create Deb package using CPack. -# CPackDeb is a CPack generator thus it uses the CPACK_XXX variables +# CPackDeb is a CPack generator thus it uses the ``CPACK_XXX`` variables # used by CPack : https://cmake.org/Wiki/CMake:CPackConfiguration. # CPackDeb generator should work on any linux host but it will produce # better deb package when Debian specific tools 'dpkg-xxx' are usable on @@ -18,7 +18,7 @@ # :code:`CPACK_DEBIAN_XXX` variables. # # :code:`CPACK_DEBIAN__XXXX` variables may be used in order to have -# **component** specific values. Note however that refers to the +# **component** specific values. Note however that ```` refers to the # **grouping name** written in upper case. It may be either a component name or # a component GROUP name. # @@ -27,11 +27,20 @@ # However as a handy reminder here comes the list of specific variables: # # .. variable:: CPACK_DEBIAN_PACKAGE_NAME +# CPACK_DEBIAN__PACKAGE_NAME # -# The Debian package summary +# Set Package control field (variable is automatically transformed to lower +# case). # # * Mandatory : YES -# * Default : :variable:`CPACK_PACKAGE_NAME` (lower case) +# * Default : +# +# - :variable:`CPACK_PACKAGE_NAME` for non-component based +# installations +# - :variable:`CPACK_DEBIAN_PACKAGE_NAME` suffixed with - +# for component-based installations. +# +# See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source # # # .. variable:: CPACK_DEBIAN_PACKAGE_VERSION @@ -100,10 +109,16 @@ # # # .. variable:: CPACK_DEBIAN_PACKAGE_SECTION +# CPACK_DEBIAN__PACKAGE_SECTION +# +# Set Section control field e.g. admin, devel, doc, ... # # * Mandatory : YES # * Default : 'devel' # +# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections +# +# # .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE # # The compression used for creating the Debian package. @@ -114,12 +129,16 @@ # # # .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY +# CPACK_DEBIAN__PACKAGE_PRIORITY # -# The Debian package priority +# Set Priority control field e.g. required, important, standard, optional, +# extra # # * Mandatory : YES # * Default : 'optional' # +# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities +# # # .. variable:: CPACK_DEBIAN_PACKAGE_HOMEPAGE # @@ -354,7 +373,28 @@ # set by Debian policy # https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners # - +# .. variable:: CPACK_DEBIAN_PACKAGE_SOURCE +# CPACK_DEBIAN__PACKAGE_SOURCE +# +# Sets the ``Source`` field of the binary Debian package. +# When the binary package name is not the same as the source package name +# (in particular when several components/binaries are generated from one +# source) the source from which the binary has been generated should be +# indicated with the field ``Source``. +# +# * Mandatory : NO +# * Default : +# +# - An empty string for non-component based installations +# - :variable:`CPACK_DEBIAN_PACKAGE_SOURCE` for component-based +# installations. +# +# See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source +# +# .. note:: +# +# This value is not interpreted. It is possible to pass an optional +# revision number of the referenced source package as well. #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -554,24 +594,33 @@ function(cpack_deb_prepare_package_vars) ) endif() + # Source: (optional) + # in case several packages are constructed from a unique source + # (multipackaging), the source may be indicated as well. + # The source might contain a version if the generated package + # version is different from the source version + if(NOT CPACK_DEBIAN_PACKAGE_SOURCE) + set(CPACK_DEBIAN_PACKAGE_SOURCE "") + endif() + # have a look at get_property(result GLOBAL PROPERTY ENABLED_FEATURES), # this returns the successful find_package() calls, maybe this can help # Depends: # You should set: DEBIAN_PACKAGE_DEPENDS # TODO: automate 'objdump -p | grep NEEDED' - # if per-component dependency, overrides the global CPACK_DEBIAN_PACKAGE_${dependency_type_} + # if per-component variable, overrides the global CPACK_DEBIAN_PACKAGE_${variable_type_} # automatic dependency discovery will be performed afterwards. if(CPACK_DEB_PACKAGE_COMPONENT) - foreach(dependency_type_ DEPENDS RECOMMENDS SUGGESTS PREDEPENDS ENHANCES BREAKS CONFLICTS PROVIDES REPLACES) - set(_component_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_${dependency_type_}") + foreach(value_type_ DEPENDS RECOMMENDS SUGGESTS PREDEPENDS ENHANCES BREAKS CONFLICTS PROVIDES REPLACES SOURCE SECTION PRIORITY NAME) + set(_component_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_${value_type_}") - # if set, overrides the global dependency + # if set, overrides the global variable if(DEFINED ${_component_var}) - set(CPACK_DEBIAN_PACKAGE_${dependency_type_} "${${_component_var}}") + set(CPACK_DEBIAN_PACKAGE_${value_type_} "${${_component_var}}") if(CPACK_DEBIAN_PACKAGE_DEBUG) - message("CPackDeb Debug: component '${_local_component_name}' ${dependency_type_}" - "dependencies set to '${CPACK_DEBIAN_PACKAGE_${dependency_}}'") + message("CPackDeb Debug: component '${_local_component_name}' ${value_type_} " + "value set to '${CPACK_DEBIAN_PACKAGE_${value_type_}}'") endif() endif() endforeach() @@ -664,23 +713,25 @@ function(cpack_deb_prepare_package_vars) endif() endforeach() - set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}") - string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME) - else() - set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "") + if(CPACK_DEBIAN_${_local_component_name}_PACKAGE_NAME) + string(TOLOWER "${CPACK_DEBIAN_${_local_component_name}_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME) + else() + string(TOLOWER "${CPACK_DEBIAN_PACKAGE_NAME}-${CPACK_DEB_PACKAGE_COMPONENT}" CPACK_DEBIAN_PACKAGE_NAME) + endif() endif() # Print out some debug information if we were asked for that if(CPACK_DEBIAN_PACKAGE_DEBUG) - message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") - message("CPackDeb:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") - message("CPackDeb:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}") - message("CPackDeb:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") - message("CPackDeb:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") - message("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") - message("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") - message("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") - message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION = ${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}") + message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = '${CPACK_TOPLEVEL_DIRECTORY}'") + message("CPackDeb:Debug: CPACK_TOPLEVEL_TAG = '${CPACK_TOPLEVEL_TAG}'") + message("CPackDeb:Debug: CPACK_TEMPORARY_DIRECTORY = '${CPACK_TEMPORARY_DIRECTORY}'") + message("CPackDeb:Debug: CPACK_OUTPUT_FILE_NAME = '${CPACK_OUTPUT_FILE_NAME}'") + message("CPackDeb:Debug: CPACK_OUTPUT_FILE_PATH = '${CPACK_OUTPUT_FILE_PATH}'") + message("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = '${CPACK_PACKAGE_FILE_NAME}'") + message("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = '${CPACK_PACKAGE_INSTALL_DIRECTORY}'") + message("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = '${CPACK_TEMPORARY_PACKAGE_FILE_NAME}'") + message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION = '${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}'") + message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_SOURCE = '${CPACK_DEBIAN_PACKAGE_SOURCE}'") endif() # For debian source packages: @@ -719,6 +770,8 @@ function(cpack_deb_prepare_package_vars) set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA}" PARENT_SCOPE) set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION "${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}" PARENT_SCOPE) + set(GEN_CPACK_DEBIAN_PACKAGE_SOURCE + "${CPACK_DEBIAN_PACKAGE_SOURCE}" PARENT_SCOPE) set(GEN_WDIR "${WDIR}" PARENT_SCOPE) endfunction() diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake index c6b3d194a..db5984a66 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 6e80fb535..c2b172311 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 0ce423c1f..5afeab685 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 6d52ec6b8..f8736e216 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 3c06d7540..84b661d15 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/CheckForPthreads.c b/Modules/CheckForPthreads.c index 2732957e1..344c81bee 100644 --- a/Modules/CheckForPthreads.c +++ b/Modules/CheckForPthreads.c @@ -16,8 +16,8 @@ int main(int ac, char*av[]){ pthread_create(&tid[0], 0, runner, (void*)1); pthread_create(&tid[1], 0, runner, (void*)2); -#if defined(__BEOS__) && !defined(__ZETA__) // (no usleep on BeOS 5.) - usleep(1); // for strange behavior on single-processor sun +#if defined(__BEOS__) && !defined(__ZETA__) /* (no usleep on BeOS 5.) */ + usleep(1); /* for strange behavior on single-processor sun */ #endif pthread_join(tid[0], 0); diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake index f90d05bd6..0bdcffa8c 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/Compiler/ARMCC-ASM.cmake b/Modules/Compiler/ARMCC-ASM.cmake new file mode 100644 index 000000000..8e3cfc5c8 --- /dev/null +++ b/Modules/Compiler/ARMCC-ASM.cmake @@ -0,0 +1,7 @@ +include(Compiler/ARMCC) + +set(CMAKE_ASM_OUTPUT_EXTENSION ".o") +set(CMAKE_ASM_OUTPUT_EXTENSION_REPLACE 1) + +set(CMAKE_ASM_COMPILE_OBJECT " -o ") +set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) diff --git a/Modules/Compiler/ARMCC-C.cmake b/Modules/Compiler/ARMCC-C.cmake new file mode 100644 index 000000000..dcdcaab4a --- /dev/null +++ b/Modules/Compiler/ARMCC-C.cmake @@ -0,0 +1,2 @@ +include(Compiler/ARMCC) +__compiler_armcc(C) diff --git a/Modules/Compiler/ARMCC-CXX.cmake b/Modules/Compiler/ARMCC-CXX.cmake new file mode 100644 index 000000000..811fc93bd --- /dev/null +++ b/Modules/Compiler/ARMCC-CXX.cmake @@ -0,0 +1,2 @@ +include(Compiler/ARMCC) +__compiler_armcc(CXX) diff --git a/Modules/Compiler/ARMCC-DetermineCompiler.cmake b/Modules/Compiler/ARMCC-DetermineCompiler.cmake new file mode 100644 index 000000000..a3667d7c2 --- /dev/null +++ b/Modules/Compiler/ARMCC-DetermineCompiler.cmake @@ -0,0 +1,16 @@ +# ARMCC Toolchain +set(_compiler_id_pp_test "defined(__ARMCC_VERSION)") + +set(_compiler_id_version_compute " +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ARMCC_VERSION/1000000) + # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ARMCC_VERSION/10000 % 100) + # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ARMCC_VERSION/100000) + # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ARMCC_VERSION/10000 % 10) + # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ARMCC_VERSION % 10000) +#endif +") diff --git a/Modules/Compiler/ARMCC.cmake b/Modules/Compiler/ARMCC.cmake new file mode 100644 index 000000000..3cf628c0d --- /dev/null +++ b/Modules/Compiler/ARMCC.cmake @@ -0,0 +1,36 @@ +if(_ARMCC_CMAKE_LOADED) + return() +endif() +set(_ARMCC_CMAKE_LOADED TRUE) + +# See ARM Compiler documentation at: +# http://infocenter.arm.com/help/topic/com.arm.doc.set.swdev/index.html + +get_filename_component(_CMAKE_C_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH) +get_filename_component(_CMAKE_CXX_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH) + +set(CMAKE_EXECUTABLE_SUFFIX ".elf") + +find_program(CMAKE_ARMCC_LINKER armlink HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" ) +find_program(CMAKE_ARMCC_AR armar HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" ) + +set(CMAKE_LINKER "${CMAKE_ARMCC_LINKER}" CACHE FILEPATH "The ARMCC linker" FORCE) +mark_as_advanced(CMAKE_ARMCC_LINKER) +set(CMAKE_AR "${CMAKE_ARMCC_AR}" CACHE FILEPATH "The ARMCC archiver" FORCE) +mark_as_advanced(CMAKE_ARMCC_AR) + +macro(__compiler_armcc lang) + set(CMAKE_${lang}_FLAGS_INIT "") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Ospace -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-Otime -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") + + set(CMAKE_${lang}_OUTPUT_EXTENSION ".o") + set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1) + + set(CMAKE_${lang}_LINK_EXECUTABLE " -o --list .map") + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY " --create -cr ") + + set(CMAKE_DEPFILE_FLAGS_${lang} "--depend= --depend_single_line --no_depend_system_headers") +endmacro() diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake index 5908c26b3..1cc72c0e5 100644 --- a/Modules/Compiler/AppleClang-C.cmake +++ b/Modules/Compiler/AppleClang-C.cmake @@ -18,6 +18,9 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0) message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}") endif() set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + set(CMAKE_C_STANDARD_DEFAULT 99) endif() endif() diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake index c4e342bf3..95bc79adc 100644 --- a/Modules/Compiler/AppleClang-CXX.cmake +++ b/Modules/Compiler/AppleClang-CXX.cmake @@ -28,6 +28,9 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") endif() set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + set(CMAKE_CXX_STANDARD_DEFAULT 98) endif() endif() diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index a2e81c142..d8b77430a 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -23,6 +23,13 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}") endif() set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6) + set(CMAKE_C_STANDARD_DEFAULT 11) + else() + set(CMAKE_C_STANDARD_DEFAULT 99) + endif() endif() endif() diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 055a8eeeb..6a0a5e2ff 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -37,6 +37,9 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") endif() set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + set(CMAKE_CXX_STANDARD_DEFAULT 98) endif() endif() diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index d979fb7a4..2c478da21 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -28,6 +28,13 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}") endif() set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) + set(CMAKE_C_STANDARD_DEFAULT 11) + else() + set(CMAKE_C_STANDARD_DEFAULT 90) + endif() endif() endif() diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index a7e71c36c..e1c555b4b 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -40,6 +40,9 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") endif() set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + set(CMAKE_CXX_STANDARD_DEFAULT 98) endif() endif() diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index 50d68eebf..b4a5591b4 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -42,6 +42,9 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") endif() set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + set(CMAKE_CXX_STANDARD_DEFAULT 98) endif() endif() diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 1fc582fae..ada5b8a72 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -653,6 +653,9 @@ set(CUDA_VERSION_STRING "${CUDA_VERSION}") # Support for arm cross compilation with CUDA 5.5 if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf") set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf" CACHE PATH "Toolkit target location.") +# Support for aarch64 cross compilation with CUDA 7.0 +elseif(CUDA_VERSION VERSION_GREATER "6.5" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/aarch64-linux") + set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}/targets/aarch64-linux" CACHE PATH "Toolkit target location.") else() set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}" CACHE PATH "Toolkit target location.") endif() @@ -764,13 +767,9 @@ if(CUDA_USE_STATIC_CUDA_RUNTIME) if (NOT APPLE) # Here is librt that has things such as, clock_gettime, shm_open, and shm_unlink. find_library(CUDA_rt_LIBRARY rt) - find_library(CUDA_dl_LIBRARY dl) if (NOT CUDA_rt_LIBRARY) message(WARNING "Expecting to find librt for libcudart_static, but didn't find it.") endif() - if (NOT CUDA_dl_LIBRARY) - message(WARNING "Expecting to find libdl for libcudart_static, but didn't find it.") - endif() endif() endif() endif() @@ -793,13 +792,10 @@ set(CUDA_LIBRARIES) if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY) list(APPEND CUDA_LIBRARIES ${CUDA_CUDARTEMU_LIBRARY}) elseif(CUDA_USE_STATIC_CUDA_RUNTIME AND CUDA_cudart_static_LIBRARY) - list(APPEND CUDA_LIBRARIES ${CUDA_cudart_static_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) + list(APPEND CUDA_LIBRARIES ${CUDA_cudart_static_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) if (CUDA_rt_LIBRARY) list(APPEND CUDA_LIBRARIES ${CUDA_rt_LIBRARY}) endif() - if (CUDA_dl_LIBRARY) - list(APPEND CUDA_LIBRARIES ${CUDA_dl_LIBRARY}) - endif() if(APPLE) # We need to add the default path to the driver (libcuda.dylib) as an rpath, so that # the static cuda runtime can find it at runtime. diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index c837c52c7..ca6649359 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -27,13 +27,17 @@ # # :: # -# FLEX_TARGET(Name FlexInput FlexOutput [COMPILE_FLAGS ]) +# FLEX_TARGET(Name FlexInput FlexOutput +# [COMPILE_FLAGS ] +# [DEFINES_FILE ] +# ) # # which creates a custom command to generate the file from # the file. If COMPILE_FLAGS option is specified, the next -# parameter is added to the flex command line. Name is an alias used to -# get details of this custom command. Indeed the macro defines the -# following variables: +# parameter is added to the flex command line. If flex is configured to +# output a header file, the DEFINES_FILE option may be used to specify its +# name. Name is an alias used to get details of this custom command. +# Indeed the macro defines the following variables: # # :: # @@ -41,6 +45,7 @@ # FLEX_${Name}_OUTPUTS - the source file generated by the custom rule, an # alias for FlexOutput # FLEX_${Name}_INPUT - the flex source file, an alias for ${FlexInput} +# FLEX_${Name}_OUTPUT_HEADER - the header flex output, if any. # # # @@ -113,6 +118,8 @@ find_path(FLEX_INCLUDE_DIR FlexLexer.h mark_as_advanced(FL_LIBRARY FLEX_INCLUDE_DIR) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) + set(FLEX_INCLUDE_DIRS ${FLEX_INCLUDE_DIR}) set(FLEX_LIBRARIES ${FL_LIBRARY}) @@ -145,31 +152,55 @@ if(FLEX_EXECUTABLE) #============================================================ # macro(FLEX_TARGET Name Input Output) - set(FLEX_TARGET_usage "FLEX_TARGET( [COMPILE_FLAGS ]") - if(${ARGC} GREATER 3) - if(${ARGC} EQUAL 5) - if("${ARGV3}" STREQUAL "COMPILE_FLAGS") - set(FLEX_EXECUTABLE_opts "${ARGV4}") - separate_arguments(FLEX_EXECUTABLE_opts) - else() - message(SEND_ERROR ${FLEX_TARGET_usage}) - endif() + set(FLEX_TARGET_outputs "${Output}") + set(FLEX_EXECUTABLE_opts "") + + set(FLEX_TARGET_PARAM_OPTIONS) + set(FLEX_TARGET_PARAM_ONE_VALUE_KEYWORDS + COMPILE_FLAGS + DEFINES_FILE + ) + set(FLEX_TARGET_PARAM_MULTI_VALUE_KEYWORDS) + + cmake_parse_arguments( + FLEX_TARGET_ARG + "${FLEX_TARGET_PARAM_OPTIONS}" + "${FLEX_TARGET_PARAM_ONE_VALUE_KEYWORDS}" + "${FLEX_TARGET_MULTI_VALUE_KEYWORDS}" + ${ARGN} + ) + + set(FLEX_TARGET_usage "FLEX_TARGET( [COMPILE_FLAGS ] [DEFINES_FILE ]") + + if(NOT "${FLEX_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "") + message(SEND_ERROR ${FLEX_TARGET_usage}) + else() + if(NOT "${FLEX_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "") + set(FLEX_EXECUTABLE_opts "${FLEX_TARGET_ARG_COMPILE_FLAGS}") + separate_arguments(FLEX_EXECUTABLE_opts) + endif() + if(NOT "${FLEX_TARGET_ARG_DEFINES_FILE}" STREQUAL "") + list(APPEND FLEX_TARGET_outputs "${FLEX_TARGET_ARG_DEFINES_FILE}") + list(APPEND FLEX_EXECUTABLE_opts --header-file=${FLEX_TARGET_ARG_DEFINES_FILE}) + endif() + + add_custom_command(OUTPUT ${FLEX_TARGET_outputs} + COMMAND ${FLEX_EXECUTABLE} + ARGS ${FLEX_EXECUTABLE_opts} -o${Output} ${Input} + DEPENDS ${Input} + COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + + set(FLEX_${Name}_DEFINED TRUE) + set(FLEX_${Name}_OUTPUTS ${Output}) + set(FLEX_${Name}_INPUT ${Input}) + set(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts}) + if("${FLEX_TARGET_ARG_DEFINES_FILE}" STREQUAL "") + set(FLEX_${Name}_OUTPUT_HEADER "") else() - message(SEND_ERROR ${FLEX_TARGET_usage}) + set(FLEX_${Name}_OUTPUT_HEADER ${FLEX_TARGET_ARG_DEFINES_FILE}) endif() endif() - - add_custom_command(OUTPUT ${Output} - COMMAND ${FLEX_EXECUTABLE} - ARGS ${FLEX_EXECUTABLE_opts} -o${Output} ${Input} - DEPENDS ${Input} - COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - - set(FLEX_${Name}_DEFINED TRUE) - set(FLEX_${Name}_OUTPUTS ${Output}) - set(FLEX_${Name}_INPUT ${Input}) - set(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts}) endmacro() #============================================================ @@ -181,11 +212,11 @@ if(FLEX_EXECUTABLE) macro(ADD_FLEX_BISON_DEPENDENCY FlexTarget BisonTarget) if(NOT FLEX_${FlexTarget}_OUTPUTS) - message(SEND_ERROR "Flex target `${FlexTarget}' does not exists.") + message(SEND_ERROR "Flex target `${FlexTarget}' does not exist.") endif() if(NOT BISON_${BisonTarget}_OUTPUT_HEADER) - message(SEND_ERROR "Bison target `${BisonTarget}' does not exists.") + message(SEND_ERROR "Bison target `${BisonTarget}' does not exist.") endif() set_source_files_properties(${FLEX_${FlexTarget}_OUTPUTS} diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 72bb8ebb0..6e4a7f2f9 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -34,6 +34,7 @@ # GTK2_FOUND - Were all of your specified components found? # GTK2_INCLUDE_DIRS - All include directories # GTK2_LIBRARIES - All libraries +# GTK2_TARGETS - All imported targets # GTK2_DEFINITIONS - Additional compiler flags # # @@ -202,6 +203,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 @@ -513,6 +551,9 @@ function(_GTK2_ADD_TARGET _var) add_library(GTK2::${_basename} UNKNOWN IMPORTED) + set(GTK2_TARGETS ${GTK2_TARGETS} GTK2::${_basename}) + set(GTK2_TARGETS ${GTK2_TARGETS} PARENT_SCOPE) + if(GTK2_${_var}_LIBRARY_RELEASE) set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK2_${_var}_LIBRARY_RELEASE}" ) @@ -565,6 +606,7 @@ endfunction() set(GTK2_FOUND) set(GTK2_INCLUDE_DIRS) set(GTK2_LIBRARIES) +set(GTK2_TARGETS) set(GTK2_DEFINITIONS) if(NOT GTK2_FIND_COMPONENTS) @@ -734,6 +776,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) @@ -882,6 +945,11 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) endif() endforeach() +if(GTK2_USE_IMPORTED_TARGETS) + set(GTK2_LIBRARIES ${GTK2_TARGETS}) +endif() + + if(_GTK2_did_we_find_everything AND NOT GTK2_VERSION_CHECK_FAILED) set(GTK2_FOUND true) else() @@ -893,6 +961,7 @@ else() set(GTK2_VERSION_PATCH) set(GTK2_INCLUDE_DIRS) set(GTK2_LIBRARIES) + set(GTK2_TARGETS) set(GTK2_DEFINITIONS) endif() diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index fccf877a8..eb7abfd73 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -124,11 +124,11 @@ function(GTEST_ADD_TESTS executable extra_args) string(REGEX MATCH "${gtest_test_type_regex}" test_type ${hit}) # Parameterized tests have a different signature for the filter - if(${test_type} STREQUAL "TEST_P") + if("x${test_type}" STREQUAL "xTEST_P") string(REGEX REPLACE ${gtest_case_name_regex} "*/\\1.\\2/*" test_name ${hit}) - elseif(${test_type} STREQUAL "TEST_F" OR ${test_type} STREQUAL "TEST") + elseif("x${test_type}" STREQUAL "xTEST_F" OR "x${test_type}" STREQUAL "xTEST") string(REGEX REPLACE ${gtest_case_name_regex} "\\1.\\2" test_name ${hit}) - elseif(${test_type} STREQUAL "TYPED_TEST") + elseif("x${test_type}" STREQUAL "xTYPED_TEST") string(REGEX REPLACE ${gtest_case_name_regex} "\\1/*.\\2" test_name ${hit}) else() message(WARNING "Could not parse GTest ${hit} for adding to CTest.") diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake index b4f7b4bf5..2c3e5fd76 100644 --- a/Modules/FindGit.cmake +++ b/Modules/FindGit.cmake @@ -48,17 +48,21 @@ if(WIN32) # GitHub search path for Windows set(github_path "$ENV{LOCALAPPDATA}/Github/PortableGit*/bin") file(GLOB github_path "${github_path}") + # SourceTree search path for Windows + set(_git_sourcetree_path "$ENV{LOCALAPPDATA}/Atlassian/SourceTree/git_local/bin") endif() endif() find_program(GIT_EXECUTABLE NAMES ${git_names} - PATHS ${github_path} + PATHS ${github_path} ${_git_sourcetree_path} PATH_SUFFIXES Git/cmd Git/bin DOC "git command line client" ) mark_as_advanced(GIT_EXECUTABLE) +unset(_git_sourcetree_path) + if(GIT_EXECUTABLE) execute_process(COMMAND ${GIT_EXECUTABLE} --version OUTPUT_VARIABLE git_version diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index d75e8ab25..8b4b9883a 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/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index e822b9c43..d519c1df3 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -328,7 +328,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma if (_pkg_check_modules_pkg_op) list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}") else() - list(APPEND _pkg_check_modules_exist_query --exists) + list(APPEND _pkg_check_modules_exist_query --exists --print-errors --short-errors) endif() _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION) @@ -342,12 +342,14 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma # execute the query execute_process( COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query} - RESULT_VARIABLE _pkgconfig_retval) + RESULT_VARIABLE _pkgconfig_retval + ERROR_VARIABLE _pkgconfig_error + ERROR_STRIP_TRAILING_WHITESPACE) # evaluate result and tell failures if (_pkgconfig_retval) if(NOT ${_is_silent}) - message(STATUS " Package '${_pkg_check_modules_pkg}' not found") + message(STATUS " ${_pkgconfig_error}") endif() set(_pkg_check_modules_failed 1) diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake index cf84826a7..a4b80e512 100644 --- a/Modules/FindXercesC.cmake +++ b/Modules/FindXercesC.cmake @@ -4,23 +4,42 @@ # # Find the Apache Xerces-C++ validating XML parser headers and libraries. # -# This module reports information about the Xerces installation in -# several variables. General variables:: +# Imported targets +# ^^^^^^^^^^^^^^^^ # -# XercesC_FOUND - true if the Xerces headers and libraries were found -# XercesC_VERSION - Xerces release version -# XercesC_INCLUDE_DIRS - the directory containing the Xerces headers -# XercesC_LIBRARIES - Xerces libraries to be linked +# This module defines the following :prop_tgt:`IMPORTED` targets: # -# The following cache variables may also be set:: +# ``XercesC::XercesC`` +# The Xerces-C++ ``xerces-c`` library, if found. # -# XercesC_INCLUDE_DIR - the directory containing the Xerces headers -# XercesC_LIBRARY - the Xerces library +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# This module will set the following variables in your project: +# +# ``XercesC_FOUND`` +# true if the Xerces headers and libraries were found +# ``XercesC_VERSION`` +# Xerces release version +# ``XercesC_INCLUDE_DIRS`` +# the directory containing the Xerces headers +# ``XercesC_LIBRARIES`` +# Xerces libraries to be linked +# +# Cache variables +# ^^^^^^^^^^^^^^^ +# +# The following cache variables may also be set: +# +# ``XercesC_INCLUDE_DIR`` +# the directory containing the Xerces headers +# ``XercesC_LIBRARY`` +# the Xerces library # Written by Roger Leigh #============================================================================= -# Copyright 2014 University of Dundee +# Copyright 2014-2015 University of Dundee # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -90,4 +109,32 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XercesC if(XercesC_FOUND) set(XercesC_INCLUDE_DIRS "${XercesC_INCLUDE_DIR}") set(XercesC_LIBRARIES "${XercesC_LIBRARY}") + + # For header-only libraries + if(NOT TARGET XercesC::XercesC) + add_library(XercesC::XercesC UNKNOWN IMPORTED) + if(XercesC_INCLUDE_DIRS) + set_target_properties(XercesC::XercesC PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${XercesC_INCLUDE_DIRS}") + endif() + if(EXISTS "${XercesC_LIBRARY}") + set_target_properties(XercesC::XercesC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${XercesC_LIBRARY}") + endif() + if(EXISTS "${XercesC_LIBRARY_DEBUG}") + set_property(TARGET XercesC::XercesC APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(XercesC::XercesC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${XercesC_LIBRARY_DEBUG}") + endif() + if(EXISTS "${XercesC_LIBRARY_RELEASE}") + set_property(TARGET XercesC::XercesC APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(XercesC::XercesC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${XercesC_LIBRARY_RELEASE}") + endif() + endif() endif() diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index e41359932..470a61ef8 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/CrayLinuxEnvironment.cmake b/Modules/Platform/CrayLinuxEnvironment.cmake new file mode 100644 index 000000000..19a0f713a --- /dev/null +++ b/Modules/Platform/CrayLinuxEnvironment.cmake @@ -0,0 +1,112 @@ +# Compute Node Linux doesn't quite work the same as native Linux so all of this +# needs to be custom. We use the variables defined through Cray's environment +# modules to set up the right paths for things. + +# Guard against multiple inclusions +if(__CrayLinuxEnvironment) + return() +endif() +set(__CrayLinuxEnvironment 1) + +set(UNIX 1) + +if(DEFINED ENV{CRAYOS_VERSION}) + set(CMAKE_SYSTEM_VERSION "$ENV{CRAYOS_VERSION}") +elseif(DEFINED ENV{XTOS_VERSION}) + set(CMAKE_SYSTEM_VERSION "$ENV{XTOS_VERSION}") +else() + message(FATAL_ERROR "Neither the CRAYOS_VERSION or XTOS_VERSION environment variables are defined. This platform file should be used inside the Cray Linux Environment for targeting compute nodes (NIDs)") +endif() +message(STATUS "Cray Linux Environment ${CMAKE_SYSTEM_VERSION}") + +# All cray systems are x86 CPUs and have been for quite some time +# Note: this may need to change in the future with 64-bit ARM +set(CMAKE_SYSTEM_PROCESSOR "x86_64") + +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") + +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) + +set(CMAKE_DL_LIBS dl) + +# Note: Much of this is pulled from UnixPaths.cmake but adjusted to the Cray +# environment accordingly + +# Get the install directory of the running cmake to the search directories +# CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels up +get_filename_component(__cmake_install_dir "${CMAKE_ROOT}" PATH) +get_filename_component(__cmake_install_dir "${__cmake_install_dir}" PATH) + + +# Note: Some Cray's have the SYSROOT_DIR variable defined, pointing to a copy +# of the NIDs userland. If so, then we'll use it. Otherwise, just assume +# the userland from the login node is ok + +# List common installation prefixes. These will be used for all +# search types. +list(APPEND CMAKE_SYSTEM_PREFIX_PATH + # Standard + $ENV{SYSROOT_DIR}/usr/local $ENV{SYSROOT_DIR}/usr $ENV{SYSROOT_DIR}/ + + # CMake install location + "${__cmake_install_dir}" + ) +if (NOT CMAKE_FIND_NO_INSTALL_PREFIX) + list(APPEND CMAKE_SYSTEM_PREFIX_PATH + # Project install destination. + "${CMAKE_INSTALL_PREFIX}" + ) + if(CMAKE_STAGING_PREFIX) + list(APPEND CMAKE_SYSTEM_PREFIX_PATH + # User-supplied staging prefix. + "${CMAKE_STAGING_PREFIX}" + ) + endif() +endif() + +list(APPEND CMAKE_SYSTEM_INCLUDE_PATH + $ENV{SYSROOT_DIR}/usr/include + $ENV{SYSROOT_DIR}/usr/include/X11 +) +list(APPEND CMAKE_SYSTEM_LIBRARY_PATH + $ENV{SYSROOT_DIR}/usr/local/lib64 + $ENV{SYSROOT_DIR}/usr/lib64 + $ENV{SYSROOT_DIR}/lib64 +) + +list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + $ENV{SYSROOT_DIR}/usr/local/lib64 + $ENV{SYSROOT_DIR}/usr/lib64 + $ENV{SYSROOT_DIR}/lib64 +) +list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES + $ENV{SYSROOT_DIR}/usr/include +) +list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES + $ENV{SYSROOT_DIR}/usr/include +) +list(APPEND CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES + $ENV{SYSROOT_DIR}/usr/include +) + +# Enable use of lib64 search path variants by default. +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) + +# Check to see if we're using the cray compiler wrappers and load accordingly +# if we are +if(DEFINED ENV{CRAYPE_DIR}) + set(_CRAYPE_ROOT "$ENV{CRAYPE_DIR}") +elseif(DEFINED ENV{ASYNCPE_DIR}) + set(_CRAYPE_ROOT "$ENV{ASYNCPE_DIR}") +endif() +if(_CRAYPE_ROOT AND + ((CMAKE_C_COMPILER MATCHES "${_CRAYPE_ROOT}") OR + (CMAKE_CXX_COMPILER MATCHES "${_CRAYPE_ROOT}") OR + (CMAKE_Fortran_COMPILER MATCHES "${_CRAYPE_ROOT}"))) + include(Platform/CrayPrgEnv) +endif() diff --git a/Modules/Platform/CrayPrgEnv.cmake b/Modules/Platform/CrayPrgEnv.cmake new file mode 100644 index 000000000..d60266b52 --- /dev/null +++ b/Modules/Platform/CrayPrgEnv.cmake @@ -0,0 +1,149 @@ +# Guard against multiple inclusions +if(__CrayPrgEnv) + return() +endif() +set(__CrayPrgEnv 1) +if(DEFINED ENV{CRAYPE_VERSION}) + message(STATUS "Cray Programming Environment $ENV{CRAYPE_VERSION}") + set(__verbose_flag "-craype-verbose") +elseif(DEFINED ENV{ASYNCPE_VERSION}) + message(STATUS "Cray Programming Environment $ENV{ASYNCPE_VERSION}") + set(__verbose_flag "-v") +else() + message(STATUS "Cray Programming Environment") +endif() + +if(NOT __CrayLinuxEnvironment) + message(FATAL_ERROR "The CrayPrgEnv platform file must not be used on its own and is intented to be included by the CrayLinuxEnvironment platform file") +endif() + +# Flags for the Cray wrappers +foreach(__lang C CXX Fortran) + set(CMAKE_STATIC_LIBRARY_LINK_${__lang}_FLAGS "-static") + set(CMAKE_SHARED_LIBRARY_${__lang}_FLAGS "") + set(CMAKE_SHARED_LIBRARY_CREATE_${__lang}_FLAGS "-shared") + set(CMAKE_SHARED_LIBRARY_LINK_${__lang}_FLAGS "-dynamic") +endforeach() + +# If the link type is not explicitly specified in the environment then +# the Cray wrappers assume that the code will be built staticly so +# we check the following condition(s) are NOT met +# Compiler flags are explicitly dynamic +# Env var is dynamic and compiler flags are not explicitly static +if(NOT (((CMAKE_C_FLAGS MATCHES "(^| )-dynamic($| )") OR + (CMAKE_CXX_FLAGS MATCHES "(^| )-dynamic($| )") OR + (CMAKE_Fortran_FLAGS MATCHES "(^| )-dynamic($| )") OR + (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )")) + OR + (("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") AND + NOT ((CMAKE_C_FLAGS MATCHES "(^| )-static($| )") OR + (CMAKE_CXX_FLAGS MATCHES "(^| )-static($| )") OR + (CMAKE_Fortran_FLAGS MATCHES "(^| )-static($| )") OR + (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-static($| )"))))) + set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + set(BUILD_SHARED_LIBS FALSE CACHE BOOL "") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + set(CMAKE_LINK_SEARCH_START_STATIC TRUE) +endif() + +function(__cray_parse_flags_with_sep OUTPUT FLAG_TAG SEP INPUT) + string(REGEX MATCHALL "${SEP}${FLAG_TAG}([^${SEP}]+)" FLAG_ARGS "${INPUT}") + foreach(FLAG_ARG IN LISTS FLAG_ARGS) + string(REGEX REPLACE + "^${SEP}${FLAG_TAG}([^${SEP}]+)" "\\1" FLAG_VALUE + "${FLAG_ARG}") + list(APPEND ${OUTPUT} ${FLAG_VALUE}) + endforeach() + set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE) +endfunction() +macro(__cray_parse_flags OUTPUT FLAG_TAG INPUT) + __cray_parse_flags_with_sep(${OUTPUT} ${FLAG_TAG} " " "${INPUT}") +endmacro() + +# Remove duplicates in a list +macro(__cray_list_remove_duplicates VAR) + if(${VAR}) + list(REMOVE_DUPLICATES ${VAR}) + endif() +endmacro() + +# Compute the intersection of several lists +function(__cray_list_intersect OUTPUT INPUT0) + if(ARGC EQUAL 2) + list(APPEND ${OUTPUT} ${${INPUT0}}) + else() + foreach(I IN LISTS ${INPUT0}) + set(__is_common 1) + foreach(L IN LISTS ARGN) + list(FIND ${L} "${I}" __idx) + if(__idx EQUAL -1) + set(__is_common 0) + break() + endif() + endforeach() + if(__is_common) + list(APPEND ${OUTPUT} "${I}") + endif() + endforeach() + endif() + set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE) +endfunction() + +# Parse the implicit directories used by the wrappers +get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach(__lang IN LISTS __langs) + if(__lang STREQUAL "C") + set(__empty empty.c) + elseif(__lang STREQUAL CXX) + set(__empty empty.cxx) + elseif(__lang STREQUAL Fortran) + set(__empty empty.f90) + else() + continue() + endif() + + execute_process( + COMMAND ${CMAKE_${__lang}_COMPILER} ${__verbose_flag} ${__empty} + OUTPUT_VARIABLE __cmd_out + ERROR_QUIET + ) + string(REGEX MATCH "(^|\n)[^\n]*${__empty}[^\n]*" __driver "${__cmd_out}") + + # Parse include paths + set(__cray_flag_args) + __cray_parse_flags(__cray_flag_args "-I" "${__driver}") + __cray_parse_flags(__cray_flag_args "-isystem " "${__driver}") + list(APPEND CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES ${__cray_flag_args}) + __cray_list_remove_duplicates(CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES) + + # Parse library paths + set(__cray_flag_args) + __cray_parse_flags(__cray_flag_args "-L" "${__driver}") + list(APPEND CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES ${__cray_flag_args}) + __cray_list_remove_duplicates(CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) + + # Parse libraries + set(__cray_flag_args) + __cray_parse_flags(__cray_flag_args "-l" "${__driver}") + __cray_parse_flags(__cray_linker_flags "-Wl" "${__driver}") + foreach(F IN LISTS __cray_linker_flags) + __cray_parse_flags_with_sep(__cray_flag_args "-l" "," "${F}") + endforeach() + list(APPEND CMAKE_${__lang}_IMPLICIT_LINK_LIBRARIES ${__cray_flag_args}) + __cray_list_remove_duplicates(CMAKE_${__lang}_IMPLICIT_LINK_LIBRARIES) +endforeach() + +# Determine the common directories between all languages and add them +# as system search paths +set(__cray_inc_path_vars) +set(__cray_lib_path_vars) +foreach(__lang IN LISTS __langs) + list(APPEND __cray_inc_path_vars CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES) + list(APPEND __cray_lib_path_vars CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) +endforeach() +if(__cray_inc_path_vars) + __cray_list_intersect(CMAKE_SYSTEM_INCLUDE_PATH ${__cray_inc_path_vars}) +endif() +if(__cray_lib_path_vars) + __cray_list_intersect(CMAKE_SYSTEM_LIBRARY_PATH ${__cray_lib_path_vars}) +endif() diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake index 77946f2aa..58398c06f 100644 --- a/Modules/Platform/SunOS.cmake +++ b/Modules/Platform/SunOS.cmake @@ -9,12 +9,6 @@ endif() include(Platform/UnixPaths) -# Add the compiler's implicit link directories. -if("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro) - list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES - /opt/SUNWspro/lib /opt/SUNWspro/prod/lib /usr/ccs/lib) -endif() - # The Sun linker needs to find transitive shared library dependencies # in the -L path. set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index b421b0d6f..a61413a87 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -302,6 +302,7 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) + set(CMAKE_NINJA_DEPTYPE_${lang} msvc) if(NOT CMAKE_RC_COMPILER_INIT) set(CMAKE_RC_COMPILER_INIT rc) @@ -311,4 +312,5 @@ macro(__windows_compiler_msvc lang) endif() enable_language(RC) + set(CMAKE_NINJA_CMCLDEPS_RC 1) endmacro() diff --git a/Packaging/CMakeDMGBackground.tif b/Packaging/CMakeDMGBackground.tif new file mode 100644 index 000000000..91c4b1309 Binary files /dev/null and b/Packaging/CMakeDMGBackground.tif differ diff --git a/Packaging/CMakeDMGSetup.scpt b/Packaging/CMakeDMGSetup.scpt new file mode 100644 index 000000000..c7ddcfb28 --- /dev/null +++ b/Packaging/CMakeDMGSetup.scpt @@ -0,0 +1,42 @@ +on run argv + set image_name to item 1 of argv + + tell application "Finder" + tell disk image_name + + -- open the image the first time and save a DS_Store with just + -- background and icon setup + open + set current view of container window to icon view + set theViewOptions to the icon view options of container window + set background picture of theViewOptions to file ".background:background.tif" + set arrangement of theViewOptions to not arranged + set icon size of theViewOptions to 128 + delay 1 + close + + -- next setup the position of the app and Applications symlink + -- plus hide all the window decoration + open + update without registering applications + tell container window + set sidebar width to 0 + set statusbar visible to false + set toolbar visible to false + set the bounds to { 400, 100, 900, 465 } + set position of item "CMake.app" to { 133, 200 } + set position of item "Applications" to { 378, 200 } + end tell + update without registering applications + delay 1 + close + + -- one last open and close so you can see everything looks correct + open + delay 5 + close + + end tell + delay 1 +end tell +end run diff --git a/README.rst b/README.rst index 5e7a323a4..9599a04b0 100644 --- a/README.rst +++ b/README.rst @@ -46,7 +46,7 @@ UNIX/Mac OSX/MinGW/MSYS/Cygwin ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ You need to have a compiler and a make installed. -Run the ``bootstrap`` script you find the in the source directory of CMake. +Run the ``bootstrap`` script you find in the source directory of CMake. You can use the ``--help`` option to see the supported options. You may use the ``--prefix=`` option to specify a custom installation directory for CMake. You can run the ``bootstrap`` script from diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index ae5b03ff9..f23331bec 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -299,8 +299,6 @@ set(SRCS cmLocalUnixMakefileGenerator3.cxx cmLocale.h ${MACH_SRCS} - cmMakeDepend.cxx - cmMakeDepend.h cmMakefile.cxx cmMakefile.h cmMakefileTargetGenerator.cxx @@ -548,6 +546,19 @@ foreach(v CURL_CA_BUNDLE CURL_CA_PATH) endif() endforeach() +foreach(check + STAT_HAS_ST_MTIM + STAT_HAS_ST_MTIMESPEC + ) + if(KWSYS_CXX_${check}_COMPILED) # abuse KWSys check cache entry + set(CMake_${check} 1) + else() + set(CMake_${check} 0) + endif() + set_property(SOURCE cmFileTimeComparison.cxx APPEND PROPERTY + COMPILE_DEFINITIONS CMake_${check}=${CMake_${check}}) +endforeach() + # create a library used by the command line and the GUI add_library(CMakeLib ${SRCS}) target_link_libraries(CMakeLib cmsys @@ -715,6 +726,9 @@ endif() # Build CPackLib add_library(CPackLib ${CPACK_SRCS}) target_link_libraries(CPackLib CMakeLib) +if(APPLE) + target_link_libraries(CPackLib "-framework Carbon") +endif() if(APPLE) add_executable(cmakexbuild cmakexbuild.cxx) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0ce169637..15782b60d 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 4) -set(CMake_VERSION_PATCH 0) -#set(CMake_VERSION_RC 0) +set(CMake_VERSION_PATCH 20151202) +#set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 43d34ee65..4eb23c182 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -24,7 +24,6 @@ #include #include -#include #include #include #include diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 6f25e50ba..d5246db43 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -482,6 +482,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() featureDefinitions.BeginElement("Feature"); featureDefinitions.AddAttribute("Id", "ProductFeature"); featureDefinitions.AddAttribute("Display", "expand"); + featureDefinitions.AddAttribute("Absent", "disallow"); featureDefinitions.AddAttribute("ConfigurableDirectory", "INSTALL_ROOT"); std::string cpackPackageName; diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx index 5a8dc6351..471c3a411 100644 --- a/Source/CPack/WiX/cmWIXPatch.cxx +++ b/Source/CPack/WiX/cmWIXPatch.cxx @@ -33,15 +33,32 @@ void cmWIXPatch::ApplyFragment( if(i == Fragments.end()) return; const cmWIXPatchElement& fragment = i->second; - for(cmWIXPatchElement::child_list_t::const_iterator - j = fragment.children.begin(); j != fragment.children.end(); ++j) - { - ApplyElement(**j, writer); - } + + this->ApplyElementChildren(fragment, writer); Fragments.erase(i); } +void cmWIXPatch::ApplyElementChildren( + const cmWIXPatchElement& element, cmWIXSourceWriter& writer) +{ + for(cmWIXPatchElement::child_list_t::const_iterator + j = element.children.begin(); j != element.children.end(); ++j) + { + cmWIXPatchNode *node = *j; + + switch(node->type()) + { + case cmWIXPatchNode::ELEMENT: + ApplyElement(dynamic_cast(*node), writer); + break; + case cmWIXPatchNode::TEXT: + writer.AddTextNode(dynamic_cast(*node).text); + break; + } + } +} + void cmWIXPatch::ApplyElement( const cmWIXPatchElement& element, cmWIXSourceWriter& writer) { @@ -53,16 +70,11 @@ void cmWIXPatch::ApplyElement( writer.AddAttribute(i->first, i->second); } - for(cmWIXPatchElement::child_list_t::const_iterator - i = element.children.begin(); i != element.children.end(); ++i) - { - ApplyElement(**i, writer); - } + this->ApplyElementChildren(element, writer); writer.EndElement(element.name); } - bool cmWIXPatch::CheckForUnappliedFragments() { std::string fragmentList; diff --git a/Source/CPack/WiX/cmWIXPatch.h b/Source/CPack/WiX/cmWIXPatch.h index 7b7b2f170..d53fcb47f 100644 --- a/Source/CPack/WiX/cmWIXPatch.h +++ b/Source/CPack/WiX/cmWIXPatch.h @@ -33,6 +33,9 @@ public: bool CheckForUnappliedFragments(); private: + void ApplyElementChildren(const cmWIXPatchElement& element, + cmWIXSourceWriter& writer); + void ApplyElement(const cmWIXPatchElement& element, cmWIXSourceWriter& writer); diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx index e066c280f..14c5413bc 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.cxx +++ b/Source/CPack/WiX/cmWIXPatchParser.cxx @@ -16,6 +16,21 @@ #include +cmWIXPatchNode::Type cmWIXPatchText::type() +{ + return cmWIXPatchNode::TEXT; +} + +cmWIXPatchNode::Type cmWIXPatchElement::type() +{ + return cmWIXPatchNode::ELEMENT; +} + +cmWIXPatchNode::~cmWIXPatchNode() +{ + +} + cmWIXPatchElement::~cmWIXPatchElement() { for(child_list_t::iterator i = children.begin(); i != children.end(); ++i) @@ -63,20 +78,20 @@ void cmWIXPatchParser::StartElement(const std::string& name, const char **atts) { cmWIXPatchElement &parent = *ElementStack.back(); - parent.children.resize(parent.children.size() + 1); - cmWIXPatchElement*& currentElement = parent.children.back(); - currentElement = new cmWIXPatchElement; - currentElement->name = name; + cmWIXPatchElement *element = new cmWIXPatchElement; + parent.children.push_back(element); + + element->name = name; for(size_t i = 0; atts[i]; i += 2) { std::string key = atts[i]; std::string value = atts[i+1]; - currentElement->attributes[key] = value; + element->attributes[key] = value; } - ElementStack.push_back(currentElement); + ElementStack.push_back(element); } } @@ -117,11 +132,34 @@ void cmWIXPatchParser::EndElement(const std::string& name) } else { - ElementStack.pop_back(); + ElementStack.pop_back(); } } } +void cmWIXPatchParser::CharacterDataHandler(const char* data, int length) +{ + const char* whitespace = "\x20\x09\x0d\x0a"; + + if(State == INSIDE_FRAGMENT) + { + cmWIXPatchElement &parent = *ElementStack.back(); + + std::string text(data, length); + + std::string::size_type first = text.find_first_not_of(whitespace); + std::string::size_type last = text.find_last_not_of(whitespace); + + if(first != std::string::npos && last != std::string::npos) + { + cmWIXPatchText *text_node = new cmWIXPatchText; + text_node->text = text.substr(first, last - first + 1); + + parent.children.push_back(text_node); + } + } +} + void cmWIXPatchParser::ReportError(int line, int column, const char* msg) { cmCPackLogger(cmCPackLog::LOG_ERROR, diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h index acfb4c071..acaeae364 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.h +++ b/Source/CPack/WiX/cmWIXPatchParser.h @@ -20,11 +20,33 @@ #include #include -struct cmWIXPatchElement +struct cmWIXPatchNode { + enum Type + { + TEXT, + ELEMENT + }; + + virtual ~cmWIXPatchNode(); + + virtual Type type() = 0; +}; + +struct cmWIXPatchText : public cmWIXPatchNode +{ + virtual Type type(); + + std::string text; +}; + +struct cmWIXPatchElement : cmWIXPatchNode +{ + virtual Type type(); + ~cmWIXPatchElement(); - typedef std::list child_list_t; + typedef std::list child_list_t; typedef std::map attributes_t; std::string name; @@ -48,6 +70,9 @@ private: void StartFragment(const char **attributes); virtual void EndElement(const std::string& name); + + virtual void CharacterDataHandler(const char* data, int length); + virtual void ReportError(int line, int column, const char* msg); void ReportValidationError(std::string const& message); diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index 8d38e9b58..63acb278f 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -102,6 +102,25 @@ void cmWIXSourceWriter::EndElement(std::string const& name) State = DEFAULT; } +void cmWIXSourceWriter::AddTextNode(std::string const& text) +{ + if(State == BEGIN) + { + File << ">"; + } + + if(Elements.empty()) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "can not add text without open WiX element in '" << + SourceFilename << "'" << std::endl); + return; + } + + File << this->EscapeAttributeValue(text); + State = DEFAULT; +} + void cmWIXSourceWriter::AddProcessingInstruction( std::string const& target, std::string const& content) { diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h index 3b9999cc6..9e303f0d8 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.h +++ b/Source/CPack/WiX/cmWIXSourceWriter.h @@ -34,6 +34,8 @@ public: void EndElement(std::string const& name); + void AddTextNode(std::string const& text); + void AddProcessingInstruction( std::string const& target, std::string const& content); diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 70de757c7..db985db81 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 6605f16e0..1f905c030 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 f1e8539b9..f5cb53cc9 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/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 04efb71aa..13c8d8f6c 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -339,6 +339,9 @@ int cmCPackDebGenerator::createDeb() this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_PROVIDES"); const char* debian_pkg_replaces = this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_REPLACES"); + const char* debian_pkg_source = + this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SOURCE"); + { // the scope is needed for cmGeneratedFileStream cmGeneratedFileStream out(ctlfilename.c_str()); @@ -347,6 +350,10 @@ int cmCPackDebGenerator::createDeb() out << "Section: " << debian_pkg_section << "\n"; out << "Priority: " << debian_pkg_priority << "\n"; out << "Architecture: " << debian_pkg_arch << "\n"; + if(debian_pkg_source && *debian_pkg_source) + { + out << "Source: " << debian_pkg_source << "\n"; + } if(debian_pkg_dep && *debian_pkg_dep) { out << "Depends: " << debian_pkg_dep << "\n"; diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 4c400d9ca..1a694eaa9 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -18,6 +18,24 @@ #include #include +#include + +#include +#include +#include + +// The carbon framework is deprecated, but the Region codes it supplies are +// needed for the LPic data structure used for generating multi-lingual SLAs. +// There does not seem to be a replacement API for these region codes. +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif +#include +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + static const char* SLAHeader = "data 'LPic' (5000) {\n" " $\"0002 0011 0003 0001 0000 0000 0002 0000\"\n" @@ -51,6 +69,7 @@ static const char* SLASTREnglish = //---------------------------------------------------------------------- cmCPackDragNDropGenerator::cmCPackDragNDropGenerator() + : singleLicense(false) { // default to one package file for components this->componentPackageMethod = ONE_PACKAGE; @@ -103,6 +122,70 @@ int cmCPackDragNDropGenerator::InitializeInternal() } this->SetOptionIfNotSet("CPACK_COMMAND_REZ", rez_path.c_str()); + if(this->IsSet("CPACK_DMG_SLA_DIR")) + { + slaDirectory = this->GetOption("CPACK_DMG_SLA_DIR"); + if(!slaDirectory.empty() && this->IsSet("CPACK_RESOURCE_FILE_LICENSE")) + { + std::string license_file = + this->GetOption("CPACK_RESOURCE_FILE_LICENSE"); + if(!license_file.empty() && + (license_file.find("CPack.GenericLicense.txt") == std::string::npos)) + { + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "Both CPACK_DMG_SLA_DIR and CPACK_RESOURCE_FILE_LICENSE specified, " + "using CPACK_RESOURCE_FILE_LICENSE as a license for all languages." + << std::endl); + singleLicense = true; + } + } + if(!this->IsSet("CPACK_DMG_SLA_LANGUAGES")) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "CPACK_DMG_SLA_DIR set but no languages defined " + "(set CPACK_DMG_SLA_LANGUAGES)" + << std::endl); + return 0; + } + if(!cmSystemTools::FileExists(slaDirectory, false)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "CPACK_DMG_SLA_DIR does not exist" + << std::endl); + return 0; + } + + std::vector languages; + cmSystemTools::ExpandListArgument( + this->GetOption("CPACK_DMG_SLA_LANGUAGES"), languages); + if(languages.empty()) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "CPACK_DMG_SLA_LANGUAGES set but empty" + << std::endl); + return 0; + } + for(size_t i = 0; i < languages.size(); ++i) + { + std::string license = slaDirectory + "/" + languages[i] + ".license.txt"; + if (!singleLicense && !cmSystemTools::FileExists(license)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Missing license file " << languages[i] << ".license.txt" + << std::endl); + return 0; + } + std::string menu = slaDirectory + "/" + languages[i] + ".menu.txt"; + if (!cmSystemTools::FileExists(menu)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Missing menu file " << languages[i] << ".menu.txt" + << std::endl); + return 0; + } + } + } + return this->Superclass::InitializeInternal(); } @@ -189,6 +272,28 @@ bool cmCPackDragNDropGenerator::CopyFile(std::ostringstream& source, return true; } +//---------------------------------------------------------------------- +bool cmCPackDragNDropGenerator::CreateEmptyFile(std::ostringstream& target, + size_t size) +{ + cmsys::ofstream fout(target.str().c_str(), + std::ios::out | std::ios::binary); + if(!fout) + { + return false; + } + else + { + // Seek to desired size - 1 byte + fout.seekp(size - 1, std::ios_base::beg); + char byte = 0; + // Write one byte to ensure file grows + fout.write(&byte, 1); + } + + return true; +} + //---------------------------------------------------------------------- bool cmCPackDragNDropGenerator::RunCommand(std::ostringstream& command, std::string* output) @@ -246,12 +351,27 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, this->GetOption("CPACK_DMG_DS_STORE") ? this->GetOption("CPACK_DMG_DS_STORE") : ""; + const std::string cpack_dmg_languages = + this->GetOption("CPACK_DMG_SLA_LANGUAGES") + ? this->GetOption("CPACK_DMG_SLA_LANGUAGES") : ""; + + const std::string cpack_dmg_ds_store_setup_script = + this->GetOption("CPACK_DMG_DS_STORE_SETUP_SCRIPT") + ? this->GetOption("CPACK_DMG_DS_STORE_SETUP_SCRIPT") : ""; + // only put license on dmg if is user provided if(!cpack_license_file.empty() && cpack_license_file.find("CPack.GenericLicense.txt") != std::string::npos) - { + { cpack_license_file = ""; - } + } + + // use sla_dir if both sla_dir and license_file are set + if(!cpack_license_file.empty() && + !slaDirectory.empty() && !singleLicense) + { + cpack_license_file = ""; + } // The staging directory contains everything that will end-up inside the // final disk image ... @@ -307,13 +427,18 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, } // Optionally add a custom background image ... + // Make sure the background file type is the same as the custom image + // and that the file is hidden so it doesn't show up. if(!cpack_dmg_background_image.empty()) { + const std::string extension = + cmSystemTools::GetFilenameLastExtension(cpack_dmg_background_image); std::ostringstream package_background_source; package_background_source << cpack_dmg_background_image; std::ostringstream package_background_destination; - package_background_destination << staging.str() << "/background.png"; + package_background_destination << staging.str() + << "/.background/background" << extension; if(!this->CopyFile(package_background_source, package_background_destination)) @@ -325,18 +450,22 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, return 0; } + } - std::ostringstream temp_background_hiding_command; - temp_background_hiding_command << this->GetOption("CPACK_COMMAND_SETFILE"); - temp_background_hiding_command << " -a V \""; - temp_background_hiding_command << package_background_destination.str(); - temp_background_hiding_command << "\""; + bool remount_image = !cpack_package_icon.empty() || + !cpack_dmg_ds_store_setup_script.empty(); - if(!this->RunCommand(temp_background_hiding_command)) + // Create 1 MB dummy padding file in staging area when we need to remount + // image, so we have enough space for storing changes ... + if(remount_image) + { + std::ostringstream dummy_padding; + dummy_padding << staging.str() << "/.dummy-padding-file"; + if(!this->CreateEmptyFile(dummy_padding, 1048576)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error setting attributes on disk volume background image." - << std::endl); + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error creating dummy padding file." + << std::endl); return 0; } @@ -365,10 +494,11 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, return 0; } - // Optionally set the custom icon flag for the image ... - if(!cpack_package_icon.empty()) + if(remount_image) { - std::ostringstream temp_mount; + // Store that we have a failure so that we always unmount the image + // before we exit. + bool had_error = false; std::ostringstream attach_command; attach_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); @@ -387,20 +517,57 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cmsys::RegularExpression mountpoint_regex(".*(/Volumes/[^\n]+)\n.*"); mountpoint_regex.find(attach_output.c_str()); + std::ostringstream temp_mount; temp_mount << mountpoint_regex.match(1); - std::ostringstream setfile_command; - setfile_command << this->GetOption("CPACK_COMMAND_SETFILE"); - setfile_command << " -a C"; - setfile_command << " \"" << temp_mount.str() << "\""; - - if(!this->RunCommand(setfile_command)) + // Remove dummy padding file so we have enough space on RW image ... + std::ostringstream dummy_padding; + dummy_padding << temp_mount.str() << "/.dummy-padding-file"; + if(!cmSystemTools::RemoveFile(dummy_padding.str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error assigning custom icon to temporary disk image." + "Error removing dummy padding file." << std::endl); - return 0; + had_error = true; + } + + // Optionally set the custom icon flag for the image ... + if(!had_error && !cpack_package_icon.empty()) + { + std::ostringstream setfile_command; + setfile_command << this->GetOption("CPACK_COMMAND_SETFILE"); + setfile_command << " -a C"; + setfile_command << " \"" << temp_mount.str() << "\""; + + if(!this->RunCommand(setfile_command)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error assigning custom icon to temporary disk image." + << std::endl); + + had_error = true; + } + } + + // Optionally we can execute a custom apple script to generate + // the .DS_Store for the volume folder ... + if(!had_error && !cpack_dmg_ds_store_setup_script.empty()) + { + std::ostringstream setup_script_command; + setup_script_command << "osascript" + << " \"" << cpack_dmg_ds_store_setup_script << "\"" + << " \"" << cpack_dmg_volume_name << "\""; + std::string error; + if(!this->RunCommand(setup_script_command, &error)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error executing custom script on disk image." << std::endl + << error + << std::endl); + + had_error = true; + } } std::ostringstream detach_command; @@ -416,56 +583,136 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, return 0; } + + if(had_error) + { + return 0; + } } - if(!cpack_license_file.empty()) - { + if(!cpack_license_file.empty() || !slaDirectory.empty()) + { + // Use old hardcoded style if sla_dir is not set + bool oldStyle = slaDirectory.empty(); std::string sla_r = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); sla_r += "/sla.r"; - cmsys::ifstream ifs; - ifs.open(cpack_license_file.c_str()); - if(ifs.is_open()) - { - cmGeneratedFileStream osf(sla_r.c_str()); - osf << "#include \n\n"; - osf << SLAHeader; - osf << "\n"; - osf << "data 'TEXT' (5002, \"English\") {\n"; - while(ifs.good()) + std::vector languages; + if(!oldStyle) { - std::string line; - std::getline(ifs, line); - // escape quotes - std::string::size_type pos = line.find('\"'); - while(pos != std::string::npos) + cmSystemTools::ExpandListArgument(cpack_dmg_languages, languages); + } + + cmGeneratedFileStream ofs(sla_r.c_str()); + ofs << "#include \n\n"; + if(oldStyle) + { + ofs << SLAHeader; + ofs << "\n"; + } + else + { + /* + * LPic Layout + * (https://github.com/pypt/dmg-add-license/blob/master/main.c) + * as far as I can tell (no official documentation seems to exist): + * struct LPic { + * uint16_t default_language; // points to a resid, defaulting to 0, + * // which is the first set language + * uint16_t length; + * struct { + * uint16_t language_code; + * uint16_t resid; + * uint16_t encoding; // Encoding from TextCommon.h, + * // forcing MacRoman (0) for now. Might need to + * // allow overwrite per license by user later + * } item[1]; + * } + */ + + // Create vector first for readability, then iterate to write to ofs + std::vector header_data; + header_data.push_back(0); + header_data.push_back(languages.size()); + for(size_t i = 0; i < languages.size(); ++i) { - line.replace(pos, 1, "\\\""); - pos = line.find('\"', pos+2); - } - // break up long lines to avoid Rez errors - std::vector lines; - const size_t max_line_length = 512; - for(size_t i=0; i line.size()) - line_length = line.size()-i; - lines.push_back(line.substr(i, line_length)); + cmCPackLogger(cmCPackLog::LOG_ERROR, + languages[i] << " is not a recognized language" + << std::endl); + } + char *iso_language_cstr = (char *) malloc(65); + CFStringGetCString(iso_language, iso_language_cstr, 64, + kCFStringEncodingMacRoman); + LangCode lang = 0; + RegionCode region = 0; + OSStatus err = LocaleStringToLangAndRegionCodes(iso_language_cstr, + &lang, ®ion); + if (err != noErr) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "No language/region code available for " << iso_language_cstr + << std::endl); + free(iso_language_cstr); + return 0; + } + free(iso_language_cstr); + header_data.push_back(region); + header_data.push_back(i); + header_data.push_back(0); + } + ofs << "data 'LPic' (5000) {\n"; + ofs << std::hex << std::uppercase << std::setfill('0'); + + for(size_t i = 0; i < header_data.size(); ++i) + { + if(i % 8 == 0) + { + ofs << " $\""; } - for(size_t i=0; iGetOption("CPACK_TOPLEVEL_DIRECTORY"); @@ -539,7 +786,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, } temp_image = temp_udco; - } + } // Create the final compressed read-only disk image ... @@ -607,3 +854,126 @@ cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix( return GetComponentPackageFileName(package_file_name, componentName, false); } + +void +cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, + int licenseNumber, std::string licenseLanguage, std::string licenseFile) +{ + if(!licenseFile.empty() && !singleLicense) + { + licenseNumber = 5002; + licenseLanguage = "English"; + } + + // License header + outputStream << "data 'TEXT' (" << licenseNumber << ", \"" + << licenseLanguage << "\") {\n"; + // License body + std::string actual_license = !licenseFile.empty() ? licenseFile : + (slaDirectory + "/" + licenseLanguage + ".license.txt"); + cmsys::ifstream license_ifs; + license_ifs.open(actual_license.c_str()); + if(license_ifs.is_open()) + { + while(license_ifs.good()) + { + std::string line; + std::getline(license_ifs, line); + if(!line.empty()) + { + EscapeQuotes(line); + std::vector lines; + BreakLongLine(line, lines); + for(size_t i = 0; i < lines.size(); ++i) + { + outputStream << " \"" << lines[i] << "\"\n"; + } + } + outputStream << " \"\\n\"\n"; + } + license_ifs.close(); + } + + // End of License + outputStream << "};\n\n"; + if(!licenseFile.empty() && !singleLicense) + { + outputStream << SLASTREnglish; + } + else + { + // Menu header + outputStream << "resource 'STR#' (" << licenseNumber << ", \"" + << licenseLanguage << "\") {\n"; + outputStream << " {\n"; + + // Menu body + cmsys::ifstream menu_ifs; + menu_ifs.open((slaDirectory+"/"+licenseLanguage+".menu.txt").c_str()); + if(menu_ifs.is_open()) + { + size_t lines_written = 0; + while(menu_ifs.good()) + { + // Lines written from original file, not from broken up lines + std::string line; + std::getline(menu_ifs, line); + if(!line.empty()) + { + EscapeQuotes(line); + std::vector lines; + BreakLongLine(line, lines); + for(size_t i = 0; i < lines.size(); ++i) + { + std::string comma; + // We need a comma after every complete string, + // but not on the very last line + if(lines_written != 8 && i == lines.size() - 1) + { + comma = ","; + } + else + { + comma = ""; + } + outputStream << " \"" << lines[i] << "\"" << comma << "\n"; + } + ++lines_written; + } + } + menu_ifs.close(); + } + + //End of menu + outputStream << " }\n"; + outputStream << "};\n"; + outputStream << "\n"; + } +} + +void +cmCPackDragNDropGenerator::BreakLongLine(const std::string& line, + std::vector& lines) +{ + const size_t max_line_length = 512; + for(size_t i = 0; i < line.size(); i += max_line_length) + { + int line_length = max_line_length; + if(i + max_line_length > line.size()) + { + line_length = line.size() - i; + } + lines.push_back(line.substr(i, line_length)); + } +} + +void +cmCPackDragNDropGenerator::EscapeQuotes(std::string& line) +{ + std::string::size_type pos = line.find('\"'); + while(pos != std::string::npos) + { + line.replace(pos, 1, "\\\""); + pos = line.find('\"', pos + 2); + } +} diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index 1c84d492d..b5e5ffe6b 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -15,6 +15,8 @@ #include "cmCPackGenerator.h" +class cmGeneratedFileStream; + /** \class cmCPackDragNDropGenerator * \brief A generator for OSX drag-n-drop installs */ @@ -34,6 +36,7 @@ protected: bool CopyFile(std::ostringstream& source, std::ostringstream& target); + bool CreateEmptyFile(std::ostringstream& target, size_t size); bool RunCommand(std::ostringstream& command, std::string* output = 0); std::string @@ -42,6 +45,16 @@ protected: int CreateDMG(const std::string& src_dir, const std::string& output_file); std::string InstallPrefix; + +private: + std::string slaDirectory; + bool singleLicense; + + void WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber, + std::string licenseLanguage, std::string licenseFile = ""); + void BreakLongLine(const std::string& line, + std::vector& lines); + void EscapeQuotes(std::string& line); }; #endif diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index def9fc7b6..22d4bf06d 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" @@ -718,13 +717,12 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cmake cm; cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); + cm.GetCurrentSnapshot().SetDefaultDefinitions(); cm.AddCMakePaths(); cm.SetProgressCallback(cmCPackGeneratorProgress, this); cmGlobalGenerator gg(&cm); cmsys::auto_ptr mf( new cmMakefile(&gg, cm.GetCurrentSnapshot())); - cmsys::auto_ptr 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 6cdda2832..5ba639fee 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 d533af87a..8940f5415 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 880663f7e..8fdc03660 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 109dcb71f..68b893f6f 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 cb9cbc49e..c08897fa4 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" @@ -200,12 +199,11 @@ int main (int argc, char const* const* argv) cmake cminst; cminst.SetHomeDirectory(""); cminst.SetHomeOutputDirectory(""); + cminst.GetCurrentSnapshot().SetDefaultDefinitions(); cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg(&cminst); cmsys::auto_ptr globalMF( new cmMakefile(&cmgg, cminst.GetCurrentSnapshot())); - cmsys::auto_ptr 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 6dbb2451c..0d74f48f2 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/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 20807c8ea..2c2cd48aa 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -820,11 +820,26 @@ int cmCTestCoverageHandler::HandleCoberturaCoverage( { cmParseCoberturaCoverage cov(*cont, this->CTest); - // Assume the coverage.xml is in the source directory - std::string coverageXMLFile = this->CTest->GetBinaryDir() + "/coverage.xml"; + // Assume the coverage.xml is in the binary directory + // check for the COBERTURADIR environment variable, + // if it doesn't exist or is empty, assume the + // binary directory is used. + std::string coverageXMLFile; + const char* covDir = cmSystemTools::GetEnv("COBERTURADIR"); + if(covDir && strlen(covDir) != 0) + { + coverageXMLFile = std::string(covDir); + } + else + { + coverageXMLFile = this->CTest->GetBinaryDir(); + } + // build the find file string with the directory from above + coverageXMLFile += "/coverage.xml"; if(cmSystemTools::FileExists(coverageXMLFile.c_str())) { + // If file exists, parse it cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Parsing Cobertura XML file: " << coverageXMLFile << std::endl, this->Quiet); @@ -833,7 +848,7 @@ int cmCTestCoverageHandler::HandleCoberturaCoverage( else { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Cannot find Cobertura XML file: " << coverageXMLFile + " Cannot find Cobertura XML file: " << coverageXMLFile << std::endl, this->Quiet); } return static_cast(cont->TotalCoverage.size()); @@ -913,16 +928,33 @@ int cmCTestCoverageHandler::HandleJacocoCoverage( { cmParseJacocoCoverage cov = cmParseJacocoCoverage(*cont, this->CTest); - cmsys::Glob g; + + // Search in the source directory. + cmsys::Glob g1; std::vector files; - g.SetRecurse(true); + g1.SetRecurse(true); std::string SourceDir = this->CTest->GetCTestConfiguration("SourceDirectory"); std::string coverageFile = SourceDir+ "/*jacoco.xml"; - g.FindFiles(coverageFile); - files=g.GetFiles(); + g1.FindFiles(coverageFile); + files = g1.GetFiles(); + + // ...and in the binary directory. + cmsys::Glob g2; + std::vector binFiles; + g2.SetRecurse(true); + std::string binaryDir + = this->CTest->GetCTestConfiguration("BuildDirectory"); + std::string binCoverageFile = binaryDir+ "/*jacoco.xml"; + g2.FindFiles(binCoverageFile); + binFiles = g2.GetFiles(); + if (!binFiles.empty()) + { + files.insert(files.end(), binFiles.begin(), binFiles.end()); + } + if (!files.empty()) { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, @@ -2287,7 +2319,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( { cper /= 2.0f; } - percent_coverage += cper; + percent_coverage += static_cast(cper); float cmet = static_cast(percentFunction + percentBranch); if(totalBranches > 0) { diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index fb0cce634..749a5beec 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 @@ -737,10 +736,9 @@ void cmCTestLaunch::LoadConfig() cmake cm; cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); + cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator gg(&cm); cmsys::auto_ptr mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); - cmsys::auto_ptr 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 c1ba2794a..ee15271a0 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(cmSystemTools::GetTime() - this->ScriptStartTime); sprintf(timeString,"%i",itime); - this->LocalGenerator->GetMakefile()->AddDefinition("CTEST_ELAPSED_TIME", - timeString); + this->Makefile->AddDefinition("CTEST_ELAPSED_TIME", timeString); } } @@ -316,28 +309,23 @@ void cmCTestScriptHandler::CreateCMake() { delete this->CMake; delete this->GlobalGenerator; - delete this->LocalGenerator; delete this->Makefile; } this->CMake = new cmake; this->CMake->SetHomeDirectory(""); this->CMake->SetHomeOutputDirectory(""); + this->CMake->GetCurrentSnapshot().SetDefaultDefinitions(); this->CMake->AddCMakePaths(); 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 42c2f209b..c9d0b6a3c 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 e19e4f41e..36576c540 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 f9678e7ba..a8f983f6f 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -24,7 +24,6 @@ #include #include "cmMakefile.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmCommand.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" @@ -580,7 +579,7 @@ int cmCTestTestHandler::ProcessHandler() } cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl - << static_cast(percent + .5) << "% tests passed, " + << static_cast(percent + .5f) << "% tests passed, " << failed.size() << " tests failed out of " << total << std::endl); if(this->CTest->GetLabelSummary()) @@ -1591,10 +1590,9 @@ void cmCTestTestHandler::GetListOfTests() cmake cm; cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); + cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator gg(&cm); cmsys::auto_ptr mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); - cmsys::auto_ptr 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 963e50173..bf2f34ac7 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/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 03417f3fe..748dd7d7e 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -734,6 +734,7 @@ bool CMakeSetupDialog::setupFirstConfigure() { dialog.saveToSettings(); this->CMakeThread->cmakeInstance()->setGenerator(dialog.getGenerator()); + this->CMakeThread->cmakeInstance()->setToolset(dialog.getToolset()); QCMakeCacheModel* m = this->CacheValues->cacheModel(); diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx index 6de9f00cc..61aad72e0 100644 --- a/Source/QtDialog/FirstConfigure.cxx +++ b/Source/QtDialog/FirstConfigure.cxx @@ -15,6 +15,11 @@ StartCompilerSetup::StartCompilerSetup(QWidget* p) l->addWidget(new QLabel(tr("Specify the generator for this project"))); this->GeneratorOptions = new QComboBox(this); l->addWidget(this->GeneratorOptions); + + // Add the ability to specify toolset (-T parameter) + ToolsetFrame = CreateToolsetWidgets(); + l->addWidget(ToolsetFrame); + l->addSpacing(6); this->CompilerSetupOptions[0] = new QRadioButton(tr("Use default native compilers"), this); @@ -36,17 +41,51 @@ StartCompilerSetup::StartCompilerSetup(QWidget* p) this, SLOT(onSelectionChanged(bool))); QObject::connect(this->CompilerSetupOptions[3], SIGNAL(toggled(bool)), this, SLOT(onSelectionChanged(bool))); + QObject::connect(GeneratorOptions, + SIGNAL(currentIndexChanged(QString const&)), + this, SLOT(onGeneratorChanged(QString const&))); +} + +QFrame* StartCompilerSetup::CreateToolsetWidgets() +{ + QFrame* frame = new QFrame(this); + QVBoxLayout* l = new QVBoxLayout(frame); + l->setContentsMargins(0, 0, 0, 0); + + ToolsetLabel = new QLabel(tr("Optional toolset to use (-T parameter)")); + l->addWidget(ToolsetLabel); + + Toolset = new QLineEdit(frame); + l->addWidget(Toolset); + + return frame; } StartCompilerSetup::~StartCompilerSetup() { } -void StartCompilerSetup::setGenerators(const QStringList& gens) +void StartCompilerSetup::setGenerators( + std::vector const& gens) { this->GeneratorOptions->clear(); - this->GeneratorOptions->addItems(gens); -}; + + QStringList generator_list; + + std::vector::const_iterator it; + for (it = gens.begin(); it != gens.end(); ++it) + { + generator_list.append(QString::fromLocal8Bit(it->name.c_str())); + + if (it->supportsToolset) + { + this->GeneratorsSupportingToolset.append( + QString::fromLocal8Bit(it->name.c_str())); + } + } + + this->GeneratorOptions->addItems(generator_list); +} void StartCompilerSetup::setCurrentGenerator(const QString& gen) { @@ -62,6 +101,11 @@ QString StartCompilerSetup::getGenerator() const return this->GeneratorOptions->currentText(); }; +QString StartCompilerSetup::getToolset() const +{ + return this->Toolset->text(); +}; + bool StartCompilerSetup::defaultSetup() const { return this->CompilerSetupOptions[0]->isChecked(); @@ -88,6 +132,18 @@ void StartCompilerSetup::onSelectionChanged(bool on) selectionChanged(); } +void StartCompilerSetup::onGeneratorChanged(QString const& name) +{ + if (GeneratorsSupportingToolset.contains(name)) + { + ToolsetFrame->show(); + } + else + { + ToolsetFrame->hide(); + } +} + int StartCompilerSetup::nextId() const { if(compilerSetup()) @@ -325,7 +381,8 @@ FirstConfigure::~FirstConfigure() { } -void FirstConfigure::setGenerators(const QStringList& gens) +void FirstConfigure::setGenerators( + std::vector const& gens) { this->mStartCompilerSetupPage->setGenerators(gens); } @@ -335,6 +392,11 @@ QString FirstConfigure::getGenerator() const return this->mStartCompilerSetupPage->getGenerator(); } +QString FirstConfigure::getToolset() const +{ + return this->mStartCompilerSetupPage->getToolset(); +} + void FirstConfigure::loadFromSettings() { QSettings settings; diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h index be390b0fd..09952b650 100644 --- a/Source/QtDialog/FirstConfigure.h +++ b/Source/QtDialog/FirstConfigure.h @@ -4,6 +4,7 @@ #include #include +#include "cmake.h" #include "ui_Compilers.h" #include "ui_CrossCompiler.h" @@ -27,9 +28,10 @@ class StartCompilerSetup : public QWizardPage public: StartCompilerSetup(QWidget* p); ~StartCompilerSetup(); - void setGenerators(const QStringList& gens); + void setGenerators(std::vector const& gens); void setCurrentGenerator(const QString& gen); QString getGenerator() const; + QString getToolset() const; bool defaultSetup() const; bool compilerSetup() const; @@ -43,10 +45,18 @@ class StartCompilerSetup : public QWizardPage protected slots: void onSelectionChanged(bool); + void onGeneratorChanged(QString const& name); protected: QComboBox* GeneratorOptions; QRadioButton* CompilerSetupOptions[4]; + QFrame* ToolsetFrame; + QLineEdit* Toolset; + QLabel* ToolsetLabel; + QStringList GeneratorsSupportingToolset; + + private: + QFrame* CreateToolsetWidgets(); }; //! the page that gives basic options for native compilers @@ -140,8 +150,9 @@ public: FirstConfigure(); ~FirstConfigure(); - void setGenerators(const QStringList& gens); + void setGenerators(std::vector const& gens); QString getGenerator() const; + QString getToolset() const; bool defaultSetup() const; bool compilerSetup() const; diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 9edbb201b..1fcb67676 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -15,7 +15,6 @@ #include #include -#include "cmake.h" #include "cmState.h" #include "cmSystemTools.h" #include "cmExternalMakefileProjectGenerator.h" @@ -46,21 +45,23 @@ QCMake::QCMake(QObject* p) cmSystemTools::SetInterruptCallback(QCMake::interruptCallback, this); - std::vector generators; + std::vector generators; this->CMakeInstance->GetRegisteredGenerators(generators); - std::vector::iterator iter; - for(iter = generators.begin(); iter != generators.end(); ++iter) + + std::vector::const_iterator it; + for(it = generators.begin(); it != generators.end(); ++it) { // Skip the generator "KDevelop3", since there is also // "KDevelop3 - Unix Makefiles", which is the full and official name. // The short name is actually only still there since this was the name // in CMake 2.4, to keep "command line argument compatibility", but // this is not necessary in the GUI. - if (*iter == "KDevelop3") + if (it->name == "KDevelop3") { continue; } - this->AvailableGenerators.append(QString::fromLocal8Bit(iter->c_str())); + + this->AvailableGenerators.push_back(*it); } } @@ -96,6 +97,7 @@ void QCMake::setBinaryDirectory(const QString& _dir) emit this->binaryDirChanged(this->BinaryDirectory); cmState* state = this->CMakeInstance->GetState(); this->setGenerator(QString()); + this->setToolset(QString()); if(!this->CMakeInstance->LoadCache( this->BinaryDirectory.toLocal8Bit().data())) { @@ -124,6 +126,12 @@ void QCMake::setBinaryDirectory(const QString& _dir) CreateFullGeneratorName(gen, extraGen? extraGen : ""); this->setGenerator(QString::fromLocal8Bit(curGen.c_str())); } + + const char* toolset = state->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET"); + if (toolset) + { + this->setToolset(QString::fromLocal8Bit(toolset)); + } } } @@ -137,6 +145,15 @@ void QCMake::setGenerator(const QString& gen) } } +void QCMake::setToolset(const QString& toolset) +{ + if(this->Toolset != toolset) + { + this->Toolset = toolset; + emit this->toolsetChanged(this->Toolset); + } +} + void QCMake::configure() { #ifdef Q_OS_WIN @@ -148,7 +165,7 @@ void QCMake::configure() this->CMakeInstance->SetGlobalGenerator( this->CMakeInstance->CreateGlobalGenerator(this->Generator.toLocal8Bit().data())); this->CMakeInstance->SetGeneratorPlatform(""); - this->CMakeInstance->SetGeneratorToolset(""); + this->CMakeInstance->SetGeneratorToolset(this->Toolset.toLocal8Bit().data()); this->CMakeInstance->LoadCache(); this->CMakeInstance->SetSuppressDevWarnings(this->SuppressDevWarnings); this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode); @@ -396,9 +413,9 @@ QString QCMake::generator() const return this->Generator; } -QStringList QCMake::availableGenerators() const +std::vector const& QCMake::availableGenerators() const { - return this->AvailableGenerators; + return AvailableGenerators; } void QCMake::deleteCache() @@ -409,6 +426,7 @@ void QCMake::deleteCache() this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data()); // emit no generator and no properties this->setGenerator(QString()); + this->setToolset(QString()); QCMakePropertyList props = this->properties(); emit this->propertiesChanged(props); } diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index d910eb7ed..2d45da965 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -17,6 +17,8 @@ #pragma warning ( disable : 4512 ) #endif +#include + #include #include #include @@ -25,7 +27,7 @@ #include #include -class cmake; +#include "cmake.h" /// struct to represent cmake properties in Qt /// Value is of type String or Bool @@ -73,6 +75,8 @@ public slots: void setBinaryDirectory(const QString& dir); /// set the desired generator to use void setGenerator(const QString& generator); + /// set the desired generator to use + void setToolset(const QString& toolset); /// do the configure step void configure(); /// generate the files @@ -104,7 +108,7 @@ public: /// get the current generator QString generator() const; /// get the available generators - QStringList availableGenerators() const; + std::vector const& availableGenerators() const; /// get whether to do debug output bool getDebugOutput() const; @@ -130,6 +134,8 @@ signals: void errorMessage(const QString& msg); /// signal when debug output changes void debugOutputChanged(bool); + /// signal when the toolset changes + void toolsetChanged(const QString& toolset); protected: cmake* CMakeInstance; @@ -147,7 +153,8 @@ protected: QString SourceDirectory; QString BinaryDirectory; QString Generator; - QStringList AvailableGenerators; + QString Toolset; + std::vector AvailableGenerators; QString CMakeExecutable; QAtomicInt InterruptFlag; }; diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index dc4db6358..e7263aead 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -70,7 +70,7 @@ * Author: Valery Fine 16/09/96 (E-mail: fine@vxcern.cern.ch) *---------------------------------------------------------------------- */ - +#include "bindexplib.h" #include #include #include @@ -173,15 +173,17 @@ public: */ DumpSymbols(ObjectHeaderType* ih, - FILE* fout, bool is64) { + std::set& symbols, + std::set& dataSymbols, + bool is64) + :Symbols(symbols), DataSymbols(dataSymbols) + { this->ObjectImageHeader = ih; this->SymbolTable = (SymbolTableType*) ((DWORD_PTR)this->ObjectImageHeader + this->ObjectImageHeader->PointerToSymbolTable); - this->FileOut = fout; this->SectionHeaders = GetSectionHeaderOffset(this->ObjectImageHeader); - this->ImportFlag = true; this->SymbolCount = this->ObjectImageHeader->NumberOfSymbols; this->Is64Bit = is64; } @@ -296,10 +298,6 @@ public: symbol.erase(0,1); } } - if (this->ImportFlag) { - this->ImportFlag = false; - fprintf(this->FileOut,"EXPORTS \n"); - } /* Check whether it is "Scalar deleting destructor" and "Vector deleting destructor" @@ -319,11 +317,11 @@ public: SectionHeaders[pSymbolTable->SectionNumber-1].Characteristics; if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) { // Read only (i.e. constants) must be excluded - fprintf(this->FileOut, "\t%s \t DATA\n", symbol.c_str()); + this->DataSymbols.insert(symbol); } else { if ( pSymbolTable->Type || !(SectChar & IMAGE_SCN_MEM_READ)) { - fprintf(this->FileOut, "\t%s\n", symbol.c_str()); + this->Symbols.insert(symbol); } else { // printf(" strange symbol: %s \n",symbol.c_str()); } @@ -340,11 +338,7 @@ public: symbol = stringTable + pSymbolTable->N.Name.Long; while (isspace(symbol[0])) symbol.erase(0,1); if (symbol[0] == '_') symbol.erase(0,1); - if (!this->ImportFlag) { - this->ImportFlag = true; - fprintf(this->FileOut,"IMPORTS \n"); - } - fprintf(this->FileOut, "\t%s DATA \n", symbol.c_str()+1); + this->DataSymbols.insert(symbol); } } @@ -357,8 +351,8 @@ public: } } private: - bool ImportFlag; - FILE* FileOut; + std::set& Symbols; + std::set& DataSymbols; DWORD_PTR SymbolCount; PIMAGE_SECTION_HEADER SectionHeaders; ObjectHeaderType* ObjectImageHeader; @@ -367,7 +361,9 @@ private: }; bool -DumpFile(const char* filename, FILE *fout) +DumpFile(const char* filename, + std::set& symbols, + std::set& dataSymbols) { HANDLE hFile; HANDLE hFileMapping; @@ -415,7 +411,7 @@ DumpFile(const char* filename, FILE *fout) * and IMAGE_FILE_HEADER.SizeOfOptionalHeader == 0; */ DumpSymbols - symbolDumper((PIMAGE_FILE_HEADER) lpFileBase, fout, + symbolDumper((PIMAGE_FILE_HEADER) lpFileBase, symbols, dataSymbols, (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)); symbolDumper.DumpObjFile(); } else { @@ -424,8 +420,9 @@ DumpFile(const char* filename, FILE *fout) (cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase; if(h->Sig1 == 0x0 && h->Sig2 == 0xffff) { DumpSymbols - symbolDumper((cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase, fout, - (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)); + symbolDumper((cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase, symbols, + dataSymbols, + (h->Machine == IMAGE_FILE_MACHINE_AMD64)); symbolDumper.DumpObjFile(); } else { printf("unrecognized file format in '%s'\n", filename); @@ -437,3 +434,27 @@ DumpFile(const char* filename, FILE *fout) CloseHandle(hFile); return true; } + +bool bindexplib::AddObjectFile(const char* filename) +{ + if(!DumpFile(filename, this->Symbols, this->DataSymbols)) + { + return false; + } + return true; +} + +void bindexplib::WriteFile(FILE* file) +{ + fprintf(file,"EXPORTS \n"); + for(std::set::const_iterator i = this->DataSymbols.begin(); + i!= this->DataSymbols.end(); ++i) + { + fprintf(file, "\t%s \t DATA\n", i->c_str()); + } + for(std::set::const_iterator i = this->Symbols.begin(); + i!= this->Symbols.end(); ++i) + { + fprintf(file, "\t%s\n", i->c_str()); + } +} diff --git a/Source/bindexplib.h b/Source/bindexplib.h new file mode 100644 index 000000000..8661a4aab --- /dev/null +++ b/Source/bindexplib.h @@ -0,0 +1,29 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef bindexplib_h +#define bindexplib_h + +#include "cmStandardIncludes.h" + + +class bindexplib +{ +public: + bindexplib() {} + bool AddObjectFile(const char* filename); + void WriteFile(FILE* file); +private: + std::set Symbols; + std::set DataSymbols; +}; +#endif diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx index 3a7494650..01e525311 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/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index d15fc1eb5..a84bb9dee 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -174,8 +174,8 @@ bool cmAddExecutableCommand this->SetError(e.str()); return false; } - cmTarget::TargetType type = aliasedTarget->GetType(); - if(type != cmTarget::EXECUTABLE) + cmState::TargetType type = aliasedTarget->GetType(); + if(type != cmState::EXECUTABLE) { std::ostringstream e; e << "cannot create ALIAS target \"" << exename @@ -192,7 +192,7 @@ bool cmAddExecutableCommand this->SetError(e.str()); return false; } - this->Makefile->AddAlias(exename, aliasedTarget); + this->Makefile->AddAlias(exename, aliasedName); return true; } @@ -210,7 +210,7 @@ bool cmAddExecutableCommand } // Create the imported target. - this->Makefile->AddImportedTarget(exename, cmTarget::EXECUTABLE, + this->Makefile->AddImportedTarget(exename, cmState::EXECUTABLE, importGlobal); return true; } diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index a844cf1ac..5296cbb36 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -25,10 +25,10 @@ bool cmAddLibraryCommand } // Library type defaults to value of BUILD_SHARED_LIBS, if it exists, // otherwise it defaults to static library. - cmTarget::TargetType type = cmTarget::SHARED_LIBRARY; + cmState::TargetType type = cmState::SHARED_LIBRARY; if (cmSystemTools::IsOff(this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) { - type = cmTarget::STATIC_LIBRARY; + type = cmState::STATIC_LIBRARY; } bool excludeFromAll = false; bool importTarget = false; @@ -50,7 +50,7 @@ bool cmAddLibraryCommand std::string libType = *s; if(libType == "STATIC") { - if (type == cmTarget::INTERFACE_LIBRARY) + if (type == cmState::INTERFACE_LIBRARY) { std::ostringstream e; e << "INTERFACE library specified with conflicting STATIC type."; @@ -58,12 +58,12 @@ bool cmAddLibraryCommand return false; } ++s; - type = cmTarget::STATIC_LIBRARY; + type = cmState::STATIC_LIBRARY; haveSpecifiedType = true; } else if(libType == "SHARED") { - if (type == cmTarget::INTERFACE_LIBRARY) + if (type == cmState::INTERFACE_LIBRARY) { std::ostringstream e; e << "INTERFACE library specified with conflicting SHARED type."; @@ -71,12 +71,12 @@ bool cmAddLibraryCommand return false; } ++s; - type = cmTarget::SHARED_LIBRARY; + type = cmState::SHARED_LIBRARY; haveSpecifiedType = true; } else if(libType == "MODULE") { - if (type == cmTarget::INTERFACE_LIBRARY) + if (type == cmState::INTERFACE_LIBRARY) { std::ostringstream e; e << "INTERFACE library specified with conflicting MODULE type."; @@ -84,12 +84,12 @@ bool cmAddLibraryCommand return false; } ++s; - type = cmTarget::MODULE_LIBRARY; + type = cmState::MODULE_LIBRARY; haveSpecifiedType = true; } else if(libType == "OBJECT") { - if (type == cmTarget::INTERFACE_LIBRARY) + if (type == cmState::INTERFACE_LIBRARY) { std::ostringstream e; e << "INTERFACE library specified with conflicting OBJECT type."; @@ -97,12 +97,12 @@ bool cmAddLibraryCommand return false; } ++s; - type = cmTarget::OBJECT_LIBRARY; + type = cmState::OBJECT_LIBRARY; haveSpecifiedType = true; } else if(libType == "UNKNOWN") { - if (type == cmTarget::INTERFACE_LIBRARY) + if (type == cmState::INTERFACE_LIBRARY) { std::ostringstream e; e << "INTERFACE library specified with conflicting UNKNOWN type."; @@ -110,12 +110,12 @@ bool cmAddLibraryCommand return false; } ++s; - type = cmTarget::UNKNOWN_LIBRARY; + type = cmState::UNKNOWN_LIBRARY; haveSpecifiedType = true; } else if(libType == "ALIAS") { - if (type == cmTarget::INTERFACE_LIBRARY) + if (type == cmState::INTERFACE_LIBRARY) { std::ostringstream e; e << "INTERFACE library specified with conflicting ALIAS type."; @@ -149,12 +149,12 @@ bool cmAddLibraryCommand return false; } ++s; - type = cmTarget::INTERFACE_LIBRARY; + type = cmState::INTERFACE_LIBRARY; haveSpecifiedType = true; } else if(*s == "EXCLUDE_FROM_ALL") { - if (type == cmTarget::INTERFACE_LIBRARY) + if (type == cmState::INTERFACE_LIBRARY) { std::ostringstream e; e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL."; @@ -174,7 +174,7 @@ bool cmAddLibraryCommand ++s; importGlobal = true; } - else if(type == cmTarget::INTERFACE_LIBRARY && *s == "GLOBAL") + else if(type == cmState::INTERFACE_LIBRARY && *s == "GLOBAL") { std::ostringstream e; e << "GLOBAL option may only be used with IMPORTED libraries."; @@ -187,7 +187,7 @@ bool cmAddLibraryCommand } } - if (type == cmTarget::INTERFACE_LIBRARY) + if (type == cmState::INTERFACE_LIBRARY) { if (s != args.end()) { @@ -220,7 +220,7 @@ bool cmAddLibraryCommand switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037)) { case cmPolicies::WARN: - if(type != cmTarget::INTERFACE_LIBRARY) + if(type != cmState::INTERFACE_LIBRARY) { e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0037) << "\n"; issueMessage = true; @@ -293,12 +293,12 @@ bool cmAddLibraryCommand this->SetError(e.str()); return false; } - cmTarget::TargetType aliasedType = aliasedTarget->GetType(); - if(aliasedType != cmTarget::SHARED_LIBRARY - && aliasedType != cmTarget::STATIC_LIBRARY - && aliasedType != cmTarget::MODULE_LIBRARY - && aliasedType != cmTarget::OBJECT_LIBRARY - && aliasedType != cmTarget::INTERFACE_LIBRARY) + cmState::TargetType aliasedType = aliasedTarget->GetType(); + if(aliasedType != cmState::SHARED_LIBRARY + && aliasedType != cmState::STATIC_LIBRARY + && aliasedType != cmState::MODULE_LIBRARY + && aliasedType != cmState::OBJECT_LIBRARY + && aliasedType != cmState::INTERFACE_LIBRARY) { std::ostringstream e; e << "cannot create ALIAS target \"" << libName @@ -314,7 +314,7 @@ bool cmAddLibraryCommand this->SetError(e.str()); return false; } - this->Makefile->AddAlias(libName, aliasedTarget); + this->Makefile->AddAlias(libName, aliasedName); return true; } @@ -328,19 +328,19 @@ bool cmAddLibraryCommand CMAKE_${LANG}_CREATE_SHARED_LIBRARY is defined and if not default to STATIC. But at this point we know only the name of the target, but not yet its linker language. */ - if ((type == cmTarget::SHARED_LIBRARY || - type == cmTarget::MODULE_LIBRARY) && + if ((type == cmState::SHARED_LIBRARY || + type == cmState::MODULE_LIBRARY) && (this->Makefile->GetState()->GetGlobalPropertyAsBool( "TARGET_SUPPORTS_SHARED_LIBS") == false)) { std::ostringstream w; w << "ADD_LIBRARY called with " << - (type==cmTarget::SHARED_LIBRARY ? "SHARED" : "MODULE") << + (type==cmState::SHARED_LIBRARY ? "SHARED" : "MODULE") << " option but the target platform does not support dynamic linking. " "Building a STATIC library instead. This may lead to problems."; this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); - type = cmTarget::STATIC_LIBRARY; + type = cmState::STATIC_LIBRARY; } // Handle imported target creation. @@ -352,7 +352,7 @@ bool cmAddLibraryCommand this->SetError("called with IMPORTED argument but no library type."); return false; } - if(type == cmTarget::OBJECT_LIBRARY) + if(type == cmState::OBJECT_LIBRARY) { this->Makefile->IssueMessage( cmake::FATAL_ERROR, @@ -360,7 +360,7 @@ bool cmAddLibraryCommand ); return true; } - if(type == cmTarget::INTERFACE_LIBRARY) + if(type == cmState::INTERFACE_LIBRARY) { if (!cmGeneratorExpression::IsValidTargetName(libName)) { @@ -387,7 +387,7 @@ bool cmAddLibraryCommand } // A non-imported target may not have UNKNOWN type. - if(type == cmTarget::UNKNOWN_LIBRARY) + if(type == cmState::UNKNOWN_LIBRARY) { this->Makefile->IssueMessage( cmake::FATAL_ERROR, @@ -408,7 +408,7 @@ bool cmAddLibraryCommand std::vector srclists; - if(type == cmTarget::INTERFACE_LIBRARY) + if(type == cmState::INTERFACE_LIBRARY) { if (!cmGeneratorExpression::IsValidTargetName(libName) || libName.find("::") != std::string::npos) diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index 79469509c..e62a2ed11 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -18,6 +18,10 @@ #include #include "cm_get_date.h" +#ifndef __LA_SSIZE_T +# define __LA_SSIZE_T la_ssize_t +#endif + //---------------------------------------------------------------------------- static std::string cm_archive_error_string(struct archive* a) { diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index 5f5017d99..92ac07dfd 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -60,10 +60,10 @@ bool cmAuxSourceDirectoryCommand::InitialPass std::string ext = file.substr(dotpos+1); std::string base = file.substr(0, dotpos); // Process only source files - if(!base.empty() - && std::find( this->Makefile->GetSourceExtensions().begin(), - this->Makefile->GetSourceExtensions().end(), ext ) - != this->Makefile->GetSourceExtensions().end() ) + std::vector srcExts = + this->Makefile->GetCMakeInstance()->GetSourceExtensions(); + if(!base.empty() && + std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end()) { std::string fullname = templateDirectory; fullname += "/"; diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index 62fafa5d5..64d4fcaad 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/cmCPackPropertiesGenerator.cxx b/Source/cmCPackPropertiesGenerator.cxx index cbcdd815e..35b3d59dc 100644 --- a/Source/cmCPackPropertiesGenerator.cxx +++ b/Source/cmCPackPropertiesGenerator.cxx @@ -18,7 +18,7 @@ void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os, const std::string& config, Indent const& indent) { std::string const& expandedFileName = - this->InstalledFile.GetNameExpression().Evaluate(this->LG->GetMakefile(), + this->InstalledFile.GetNameExpression().Evaluate(this->LG, config); cmInstalledFile::PropertyMapType const& properties = @@ -38,7 +38,7 @@ void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os, j = property.ValueExpressions.begin(); j != property.ValueExpressions.end(); ++j) { - std::string value = (*j)->Evaluate(LG->GetMakefile(), config); + std::string value = (*j)->Evaluate(this->LG, config); os << " " << cmOutputConverter::EscapeForCMake(value); } diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 7da334ef1..fb78446dc 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -51,14 +51,14 @@ void CCONV cmSetError(void *info, const char *err) unsigned int CCONV cmGetCacheMajorVersion(void *arg) { cmMakefile *mf = static_cast(arg); - cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager(); - return manager->GetCacheMajorVersion(); + cmState *state = mf->GetState(); + return state->GetCacheMajorVersion(); } unsigned int CCONV cmGetCacheMinorVersion(void *arg) { cmMakefile *mf = static_cast(arg); - cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager(); - return manager->GetCacheMinorVersion(); + cmState *state = mf->GetState(); + return state->GetCacheMinorVersion(); } unsigned int CCONV cmGetMajorVersion(void *) @@ -116,7 +116,7 @@ const char* CCONV cmGetProjectName(void *arg) { cmMakefile *mf = static_cast(arg); static std::string name; - name = mf->GetProjectName(); + name = mf->GetStateSnapshot().GetProjectName(); return name.c_str(); } @@ -373,13 +373,13 @@ void CCONV cmAddLinkLibraryForTarget(void *arg, const char *tgt, switch (libtype) { case CM_LIBRARY_GENERAL: - mf->AddLinkLibraryForTarget(tgt,value, cmTarget::GENERAL); + mf->AddLinkLibraryForTarget(tgt,value, GENERAL_LibraryType); break; case CM_LIBRARY_DEBUG: - mf->AddLinkLibraryForTarget(tgt,value, cmTarget::DEBUG); + mf->AddLinkLibraryForTarget(tgt,value, DEBUG_LibraryType); break; case CM_LIBRARY_OPTIMIZED: - mf->AddLinkLibraryForTarget(tgt,value, cmTarget::OPTIMIZED); + mf->AddLinkLibraryForTarget(tgt,value, OPTIMIZED_LibraryType); break; } } @@ -395,7 +395,7 @@ void CCONV cmAddLibrary(void *arg, const char *libname, int shared, srcs2.push_back(srcs[i]); } mf->AddLibrary(libname, - (shared? cmTarget::SHARED_LIBRARY : cmTarget::STATIC_LIBRARY), + (shared? cmState::SHARED_LIBRARY : cmState::STATIC_LIBRARY), srcs2); } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 6e55d8939..f3e7121f7 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 #include @@ -518,9 +517,9 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) cmake cm; cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); + cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator gg(&cm); cmsys::auto_ptr mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); - cmsys::auto_ptr lg(gg.CreateLocalGenerator(mf.get())); if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf.get()) ) { diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 54209c5ce..ce8af55db 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -13,7 +13,6 @@ #include "cmCacheManager.h" #include "cmSystemTools.h" #include "cmGeneratedFileStream.h" -#include "cmMakefile.h" #include "cmake.h" #include "cmVersion.h" @@ -22,101 +21,10 @@ #include #include -cmCacheManager::cmCacheManager(cmake* cm) +cmCacheManager::cmCacheManager() { this->CacheMajorVersion = 0; this->CacheMinorVersion = 0; - this->CMakeInstance = cm; -} - -bool cmCacheManager::LoadCache(const std::string& path) -{ - std::set emptySet; - return this->LoadCache(path, true, emptySet, emptySet); -} - -static bool ParseEntryWithoutType(const std::string& entry, - std::string& var, - std::string& value) -{ - // input line is: key=value - static cmsys::RegularExpression reg( - "^([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); - // input line is: "key"=value - static cmsys::RegularExpression regQuoted( - "^\"([^\"]*)\"=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); - bool flag = false; - if(regQuoted.find(entry)) - { - var = regQuoted.match(1); - value = regQuoted.match(2); - flag = true; - } - else if (reg.find(entry)) - { - var = reg.match(1); - value = reg.match(2); - flag = true; - } - - // if value is enclosed in single quotes ('foo') then remove them - // it is used to enclose trailing space or tab - if (flag && - value.size() >= 2 && - value[0] == '\'' && - value[value.size() - 1] == '\'') - { - value = value.substr(1, - value.size() - 2); - } - - return flag; -} - -bool cmCacheManager::ParseEntry(const std::string& entry, - std::string& var, - std::string& value, - cmState::CacheEntryType& type) -{ - // input line is: key:type=value - static cmsys::RegularExpression reg( - "^([^=:]*):([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); - // input line is: "key":type=value - static cmsys::RegularExpression regQuoted( - "^\"([^\"]*)\":([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); - bool flag = false; - if(regQuoted.find(entry)) - { - var = regQuoted.match(1); - type = cmState::StringToCacheEntryType(regQuoted.match(2).c_str()); - value = regQuoted.match(3); - flag = true; - } - else if (reg.find(entry)) - { - var = reg.match(1); - type = cmState::StringToCacheEntryType(reg.match(2).c_str()); - value = reg.match(3); - flag = true; - } - - // if value is enclosed in single quotes ('foo') then remove them - // it is used to enclose trailing space or tab - if (flag && - value.size() >= 2 && - value[0] == '\'' && - value[value.size() - 1] == '\'') - { - value = value.substr(1, - value.size() - 2); - } - - if (!flag) - { - return ParseEntryWithoutType(entry, var, value); - } - - return flag; } void cmCacheManager::CleanCMakeFiles(const std::string& path) @@ -195,7 +103,7 @@ bool cmCacheManager::LoadCache(const std::string& path, } } e.SetProperty("HELPSTRING", helpString.c_str()); - if(cmCacheManager::ParseEntry(realbuffer, entryKey, e.Value, e.Type)) + if(cmState::ParseCacheEntry(realbuffer, entryKey, e.Value, e.Type)) { if ( excludes.find(entryKey) == excludes.end() ) { @@ -678,7 +586,6 @@ void cmCacheManager::AddCacheEntry(const std::string& key, } e.SetProperty("HELPSTRING", helpString? helpString : "(This variable does not exist and should not be used)"); - this->CMakeInstance->UnwatchUnusedCli(key); } bool cmCacheManager::CacheIterator::IsAtEnd() const diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 846225978..6f063ebbc 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -16,9 +16,7 @@ #include "cmPropertyMap.h" #include "cmState.h" -class cmMakefile; class cmMarkAsAdvancedCommand; -class cmake; /** \class cmCacheManager * \brief Control class for cmake's cache @@ -29,7 +27,7 @@ class cmake; class cmCacheManager { public: - cmCacheManager(cmake* cm); + cmCacheManager(); class CacheIterator; friend class cmCacheManager::CacheIterator; @@ -100,7 +98,6 @@ public: } ///! Load a cache for given makefile. Loads from path/CMakeCache.txt. - bool LoadCache(const std::string& path); bool LoadCache(const std::string& path, bool internal, std::set& excludes, std::set& includes); @@ -124,12 +121,6 @@ public: int GetSize() { return static_cast(this->Cache.size()); } - ///! Break up a line like VAR:type="value" into var, type and value - static bool ParseEntry(const std::string& entry, - std::string& var, - std::string& value, - cmState::CacheEntryType& type); - ///! Get a value from the cache given a key const char* GetInitializedCacheValue(const std::string& key) const; @@ -241,7 +232,7 @@ private: void WritePropertyEntries(std::ostream& os, CacheIterator const& i); CacheEntryMap Cache; - // Only cmake and cmMakefile should be able to add cache values + // Only cmake and cmState should be able to add cache values // the commands should never use the cmCacheManager directly friend class cmState; // allow access to add cache values friend class cmake; // allow access to add cache values diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 252e2312d..76ed0387c 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -18,7 +18,6 @@ #include "cmMakefile.h" #include "cmSourceFile.h" #include "cmSystemTools.h" -#include "cmTarget.h" cmCommonTargetGenerator::cmCommonTargetGenerator( cmOutputConverter::RelativeRoot wd, @@ -26,7 +25,6 @@ cmCommonTargetGenerator::cmCommonTargetGenerator( ) : WorkingDirectory(wd) , GeneratorTarget(gt) - , Target(gt->Target) , Makefile(gt->Makefile) , LocalGenerator(static_cast(gt->LocalGenerator)) , GlobalGenerator(static_cast( @@ -83,7 +81,7 @@ void cmCommonTargetGenerator::AddFeatureFlags( //---------------------------------------------------------------------------- void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags) { - if(this->ModuleDefinitionFile.empty()) + if(!this->ModuleDefinitionFile) { return; } @@ -100,7 +98,7 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags) // vs6's "cl -link" pass it to the linker. std::string flag = defFileFlag; flag += (this->LocalGenerator->ConvertToLinkReference( - this->ModuleDefinitionFile)); + this->ModuleDefinitionFile->GetFullPath())); this->LocalGenerator->AppendFlags(flags, flag); } @@ -109,7 +107,7 @@ std::string cmCommonTargetGenerator::ComputeFortranModuleDirectory() const { std::string mod_dir; const char* target_mod_dir = - this->Target->GetProperty("Fortran_MODULE_DIRECTORY"); + this->GeneratorTarget->GetProperty("Fortran_MODULE_DIRECTORY"); const char* moddir_flag = this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG"); if(target_mod_dir && moddir_flag) @@ -123,7 +121,7 @@ std::string cmCommonTargetGenerator::ComputeFortranModuleDirectory() const else { // Interpret relative to the current output directory. - mod_dir = this->Makefile->GetCurrentBinaryDirectory(); + mod_dir = this->LocalGenerator->GetCurrentBinaryDirectory(); mod_dir += "/"; mod_dir += target_mod_dir; } @@ -214,7 +212,7 @@ cmCommonTargetGenerator this->LocalGenerator->GetFortranFormat(srcfmt); if(format == cmLocalGenerator::FortranFormatNone) { - const char* tgtfmt = this->Target->GetProperty("Fortran_FORMAT"); + const char* tgtfmt = this->GeneratorTarget->GetProperty("Fortran_FORMAT"); format = this->LocalGenerator->GetFortranFormat(tgtfmt); } const char* var = 0; @@ -265,7 +263,7 @@ std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l) for(std::vector::iterator i = includes.begin(); i != includes.end(); ++i) { - if(this->Target->NameResolvesToFramework(*i)) + if(this->GlobalGenerator->NameResolvesToFramework(*i)) { std::string frameworkDir = *i; frameworkDir += "/../"; @@ -316,10 +314,11 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string &l) this->AddFortranFlags(flags); } - this->LocalGenerator->AddCMP0018Flags(flags, this->Target, + this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang, this->ConfigName); - this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target, + this->LocalGenerator->AddVisibilityPresetFlags(flags, + this->GeneratorTarget, lang); // Append old-style preprocessor definition flags. @@ -331,7 +330,7 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string &l) AppendFlags(flags,this->GetFrameworkFlags(l)); // Add target-specific flags. - this->LocalGenerator->AddCompileOptions(flags, this->Target, + this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, lang, this->ConfigName); ByLanguageMap::value_type entry(l, flags); @@ -348,13 +347,14 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string &l) std::set defines; const char *lang = l.c_str(); // Add the export symbol definition for shared library objects. - if(const char* exportMacro = this->Target->GetExportMacro()) + if(const char* exportMacro = + this->GeneratorTarget->GetExportMacro()) { this->LocalGenerator->AppendDefines(defines, exportMacro); } // Add preprocessor definitions for this target and configuration. - this->LocalGenerator->AddCompileDefinitions(defines, this->Target, + this->LocalGenerator->AddCompileDefinitions(defines, this->GeneratorTarget, this->LocalGenerator->GetConfigName(), l); std::string definesString; @@ -383,7 +383,7 @@ std::vector cmCommonTargetGenerator::GetLinkedTargetDirectories() const { std::vector dirs; - std::set emitted; + std::set emitted; if (cmComputeLinkInformation* cli = this->GeneratorTarget->GetLinkInformation(this->ConfigName)) { @@ -391,21 +391,18 @@ cmCommonTargetGenerator::GetLinkedTargetDirectories() const for(cmComputeLinkInformation::ItemVector::const_iterator i = items.begin(); i != items.end(); ++i) { - cmTarget const* linkee = i->Target; + cmGeneratorTarget const* linkee = i->Target; if(linkee && !linkee->IsImported() // We can ignore the INTERFACE_LIBRARY items because // Target->GetLinkInformation already processed their // link interface and they don't have any output themselves. - && linkee->GetType() != cmTarget::INTERFACE_LIBRARY + && linkee->GetType() != cmState::INTERFACE_LIBRARY && emitted.insert(linkee).second) { - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(linkee); - cmLocalGenerator* lg = gt->GetLocalGenerator(); - cmMakefile* mf = linkee->GetMakefile(); - std::string di = mf->GetCurrentBinaryDirectory(); + cmLocalGenerator* lg = linkee->GetLocalGenerator(); + std::string di = lg->GetCurrentBinaryDirectory(); di += "/"; - di += lg->GetTargetDirectory(*linkee); + di += lg->GetTargetDirectory(linkee); dirs.push_back(di); } } diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index a4b2c10ec..0c1750012 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -21,7 +21,6 @@ class cmGlobalCommonGenerator; class cmLocalCommonGenerator; class cmMakefile; class cmSourceFile; -class cmTarget; /** \class cmCommonTargetGenerator * \brief Common infrastructure for Makefile and Ninja per-target generators @@ -49,14 +48,13 @@ protected: cmOutputConverter::RelativeRoot WorkingDirectory; cmGeneratorTarget* GeneratorTarget; - cmTarget* Target; cmMakefile* Makefile; cmLocalCommonGenerator* LocalGenerator; cmGlobalCommonGenerator* GlobalGenerator; std::string ConfigName; // The windows module definition source file (.def), if any. - std::string ModuleDefinitionFile; + cmSourceFile const* ModuleDefinitionFile; // Target-wide Fortran module output directory. bool FortranModuleDirectoryComputed; diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 1b5c9f417..13098ad5b 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -185,7 +185,9 @@ cmComputeLinkDepends // The configuration being linked. this->HasConfig = !config.empty(); this->Config = (this->HasConfig)? config : std::string(); - this->LinkType = this->Target->Target->ComputeLinkType(this->Config); + std::vector debugConfigs = + this->Makefile->GetCMakeInstance()->GetDebugConfigs(); + this->LinkType = CMP0003_ComputeLinkType(this->Config, debugConfigs); // Enable debug mode if requested. this->DebugMode = this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE"); @@ -268,9 +270,9 @@ cmComputeLinkDepends::Compute() { int i = *li; LinkEntry const& e = this->EntryList[i]; - cmTarget const* t = e.Target; + cmGeneratorTarget const* t = e.Target; // Entries that we know the linker will re-use do not need to be repeated. - bool uniquify = t && t->GetType() == cmTarget::SHARED_LIBRARY; + bool uniquify = t && t->GetType() == cmState::SHARED_LIBRARY; if(!uniquify || emmitted.insert(i).second) { this->FinalLinkEntries.push_back(e); @@ -362,14 +364,12 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe) // Follow the item's dependencies. if(entry.Target) { - cmGeneratorTarget* gtgt = - this->GlobalGenerator->GetGeneratorTarget(entry.Target); // Follow the target dependencies. if(cmLinkInterface const* iface = - gtgt->GetLinkInterface(this->Config, this->Target->Target)) + entry.Target->GetLinkInterface(this->Config, this->Target)) { const bool isIface = - entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY; + entry.Target->GetType() == cmState::INTERFACE_LIBRARY; // This target provides its own link interface information. this->AddLinkEntries(depender_index, iface->Libraries); @@ -463,10 +463,8 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) // Target items may have their own dependencies. if(entry.Target) { - cmGeneratorTarget* gtgt = - this->GlobalGenerator->GetGeneratorTarget(entry.Target); if(cmLinkInterface const* iface = - gtgt->GetLinkInterface(this->Config, this->Target->Target)) + entry.Target->GetLinkInterface(this->Config, this->Target)) { // Follow public and private dependencies transitively. this->FollowSharedDeps(index, iface, true); @@ -486,24 +484,24 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, // Look for entries meant for this configuration. std::vector actual_libs; - cmTarget::LinkLibraryType llt = cmTarget::GENERAL; + cmTargetLinkLibraryType llt = GENERAL_LibraryType; bool haveLLT = false; for(std::vector::const_iterator di = deplist.begin(); di != deplist.end(); ++di) { if(*di == "debug") { - llt = cmTarget::DEBUG; + llt = DEBUG_LibraryType; haveLLT = true; } else if(*di == "optimized") { - llt = cmTarget::OPTIMIZED; + llt = OPTIMIZED_LibraryType; haveLLT = true; } else if(*di == "general") { - llt = cmTarget::GENERAL; + llt = GENERAL_LibraryType; haveLLT = true; } else if(!di->empty()) @@ -521,17 +519,17 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, { if(strcmp(val, "debug") == 0) { - llt = cmTarget::DEBUG; + llt = DEBUG_LibraryType; } else if(strcmp(val, "optimized") == 0) { - llt = cmTarget::OPTIMIZED; + llt = OPTIMIZED_LibraryType; } } } // If the library is meant for this link type then use it. - if(llt == cmTarget::GENERAL || llt == this->LinkType) + if(llt == GENERAL_LibraryType || llt == this->LinkType) { cmLinkItem item(*di, this->FindTargetToLink(depender_index, *di)); actual_libs.push_back(item); @@ -543,7 +541,7 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, } // Reset the link type until another explicit type is given. - llt = cmTarget::GENERAL; + llt = GENERAL_LibraryType; haveLLT = false; } } @@ -635,14 +633,16 @@ cmComputeLinkDepends::AddLinkEntries( } //---------------------------------------------------------------------------- -cmTarget const* cmComputeLinkDepends::FindTargetToLink(int depender_index, - const std::string& name) +cmGeneratorTarget const* +cmComputeLinkDepends::FindTargetToLink(int depender_index, + const std::string& name) { // Look for a target in the scope of the depender. - cmTarget const* from = this->Target->Target; + cmGeneratorTarget const* from = this->Target; if(depender_index >= 0) { - if(cmTarget const* depender = this->EntryList[depender_index].Target) + if(cmGeneratorTarget const* depender = + this->EntryList[depender_index].Target) { from = depender; } @@ -934,12 +934,10 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl) int count = 2; for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { - if(cmTarget const* target = this->EntryList[*ni].Target) + if(cmGeneratorTarget const* target = this->EntryList[*ni].Target) { - cmGeneratorTarget* gtgt = - this->GlobalGenerator->GetGeneratorTarget(target); if(cmLinkInterface const* iface = - gtgt->GetLinkInterface(this->Config, this->Target->Target)) + target->GetLinkInterface(this->Config, this->Target)) { if(iface->Multiplicity > count) { diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 2cbb43013..f10e4e435 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -13,7 +13,7 @@ #define cmComputeLinkDepends_h #include "cmStandardIncludes.h" -#include "cmTarget.h" +#include "cmLinkItem.h" #include "cmGraphAdjacencyList.h" @@ -23,7 +23,6 @@ class cmComputeComponentGraph; class cmGlobalGenerator; class cmMakefile; class cmGeneratorTarget; -class cmTarget; class cmake; /** \class cmComputeLinkDepends @@ -40,7 +39,7 @@ public: struct LinkEntry { std::string Item; - cmTarget const* Target; + cmGeneratorTarget const* Target; bool IsSharedDep; bool IsFlag; LinkEntry(): Item(), Target(0), IsSharedDep(false), IsFlag(false) {} @@ -53,7 +52,7 @@ public: EntryVector const& Compute(); void SetOldLinkDirMode(bool b); - std::set const& GetOldWrongConfigItems() const + std::set const& GetOldWrongConfigItems() const { return this->OldWrongConfigItems; } private: @@ -66,8 +65,6 @@ private: std::string Config; EntryVector FinalLinkEntries; - typedef cmTarget::LinkLibraryVectorType LinkLibraryVectorType; - std::map::iterator AllocateLinkEntry(std::string const& item); int AddLinkEntry(cmLinkItem const& item); @@ -75,8 +72,8 @@ private: void AddDirectLinkEntries(); template void AddLinkEntries(int depender_index, std::vector const& libs); - cmTarget const* FindTargetToLink(int depender_index, - const std::string& name); + cmGeneratorTarget const* FindTargetToLink(int depender_index, + const std::string& name); // One entry for each unique item. std::vector EntryList; @@ -153,11 +150,11 @@ private: // Record of the original link line. std::vector OriginalEntries; - std::set OldWrongConfigItems; + std::set OldWrongConfigItems; void CheckWrongConfigItem(cmLinkItem const& item); int ComponentOrderId; - cmTarget::LinkLibraryType LinkType; + cmTargetLinkLibraryType LinkType; bool HasConfig; bool DebugMode; bool OldLinkDirMode; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index d35b566ad..50d832438 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -19,7 +19,6 @@ #include "cmState.h" #include "cmOutputConverter.h" #include "cmMakefile.h" -#include "cmTarget.h" #include "cmGeneratorTarget.h" #include "cmake.h" #include "cmAlgorithms.h" @@ -284,14 +283,14 @@ cmComputeLinkInformation // Check whether we should skip dependencies on shared library files. this->LinkDependsNoShared = - this->Target->Target->GetPropertyAsBool("LINK_DEPENDS_NO_SHARED"); + this->Target->GetPropertyAsBool("LINK_DEPENDS_NO_SHARED"); // On platforms without import libraries there may be a special flag // to use when creating a plugin (module) that obtains symbols from // the program that will load it. this->LoaderFlag = 0; if(!this->UseImportLibrary && - this->Target->Target->GetType() == cmTarget::MODULE_LIBRARY) + this->Target->GetType() == cmState::MODULE_LIBRARY) { std::string loader_flag_var = "CMAKE_SHARED_MODULE_LOADER_"; loader_flag_var += this->LinkLanguage; @@ -309,10 +308,10 @@ cmComputeLinkInformation // Get options needed to specify RPATHs. this->RuntimeUseChrpath = false; - if(this->Target->Target->GetType() != cmTarget::STATIC_LIBRARY) + if(this->Target->GetType() != cmState::STATIC_LIBRARY) { const char* tType = - ((this->Target->Target->GetType() == cmTarget::EXECUTABLE)? + ((this->Target->GetType() == cmState::EXECUTABLE)? "EXECUTABLE" : "SHARED_LIBRARY"); std::string rtVar = "CMAKE_"; rtVar += tType; @@ -378,9 +377,9 @@ cmComputeLinkInformation // Add the search path entries requested by the user to path ordering. this->OrderLinkerSearchPath - ->AddUserDirectories(this->Target->Target->GetLinkDirectories()); + ->AddUserDirectories(this->Target->GetLinkDirectories()); this->OrderRuntimeSearchPath - ->AddUserDirectories(this->Target->Target->GetLinkDirectories()); + ->AddUserDirectories(this->Target->GetLinkDirectories()); // Set up the implicit link directories. this->LoadImplicitLinkInfo(); @@ -408,13 +407,13 @@ cmComputeLinkInformation // order to support such projects we need to add the directories // containing libraries linked with a full path to the -L path. this->OldLinkDirMode = - this->Target->Target->GetPolicyStatusCMP0003() != cmPolicies::NEW; + this->Target->GetPolicyStatusCMP0003() != cmPolicies::NEW; if(this->OldLinkDirMode) { // Construct a mask to not bother with this behavior for link // directories already specified by the user. std::vector const& dirs = - this->Target->Target->GetLinkDirectories(); + this->Target->GetLinkDirectories(); this->OldLinkDirMask.insert(dirs.begin(), dirs.end()); } @@ -471,7 +470,7 @@ std::vector const& cmComputeLinkInformation::GetFrameworkPaths() } //---------------------------------------------------------------------------- -std::set const& +const std::set& cmComputeLinkInformation::GetSharedLibrariesLinked() { return this->SharedLibrariesLinked; @@ -481,10 +480,10 @@ cmComputeLinkInformation::GetSharedLibrariesLinked() bool cmComputeLinkInformation::Compute() { // Skip targets that do not link. - if(!(this->Target->GetType() == cmTarget::EXECUTABLE || - this->Target->GetType() == cmTarget::SHARED_LIBRARY || - this->Target->GetType() == cmTarget::MODULE_LIBRARY || - this->Target->GetType() == cmTarget::STATIC_LIBRARY)) + if(!(this->Target->GetType() == cmState::EXECUTABLE || + this->Target->GetType() == cmState::SHARED_LIBRARY || + this->Target->GetType() == cmState::MODULE_LIBRARY || + this->Target->GetType() == cmState::STATIC_LIBRARY)) { return false; } @@ -521,7 +520,7 @@ bool cmComputeLinkInformation::Compute() // Restore the target link type so the correct system runtime // libraries are found. const char* lss = - this->Target->Target->GetProperty("LINK_SEARCH_END_STATIC"); + this->Target->GetProperty("LINK_SEARCH_END_STATIC"); if(cmSystemTools::IsOn(lss)) { this->SetCurrentLinkType(LinkStatic); @@ -537,16 +536,16 @@ bool cmComputeLinkInformation::Compute() // For CMake 2.4 bug-compatibility we need to consider the output // directories of targets linked in another configuration as link // directories. - std::set const& wrongItems = cld.GetOldWrongConfigItems(); - for(std::set::const_iterator i = wrongItems.begin(); - i != wrongItems.end(); ++i) + std::set const& wrongItems = + cld.GetOldWrongConfigItems(); + for(std::set::const_iterator i = + wrongItems.begin(); i != wrongItems.end(); ++i) { - cmTarget const* tgt = *i; - cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt); + cmGeneratorTarget const* tgt = *i; bool implib = (this->UseImportLibrary && - (tgt->GetType() == cmTarget::SHARED_LIBRARY)); - std::string lib = gtgt->GetFullPath(this->Config , implib, true); + (tgt->GetType() == cmState::SHARED_LIBRARY)); + std::string lib = tgt->GetFullPath(this->Config , implib, true); this->OldLinkDirItems.push_back(lib); } } @@ -572,7 +571,7 @@ bool cmComputeLinkInformation::Compute() "name." ; this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), - this->Target->Target->GetBacktrace()); + this->Target->GetBacktrace()); } return true; @@ -632,7 +631,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang) //---------------------------------------------------------------------------- void cmComputeLinkInformation::AddItem(std::string const& item, - cmTarget const* tgt) + cmGeneratorTarget const* tgt) { // Compute the proper name to use to link this library. const std::string& config = this->Config; @@ -646,7 +645,6 @@ void cmComputeLinkInformation::AddItem(std::string const& item, if(tgt && tgt->IsLinkable()) { - cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt); // This is a CMake target. Ask the target for its real name. if(impexe && this->LoaderFlag) { @@ -656,13 +654,13 @@ void cmComputeLinkInformation::AddItem(std::string const& item, std::string linkItem; linkItem = this->LoaderFlag; - std::string exe = gtgt->GetFullPath(config, this->UseImportLibrary, + std::string exe = tgt->GetFullPath(config, this->UseImportLibrary, true); linkItem += exe; this->Items.push_back(Item(linkItem, true, tgt)); this->Depends.push_back(exe); } - else if(tgt->GetType() == cmTarget::INTERFACE_LIBRARY) + else if(tgt->GetType() == cmState::INTERFACE_LIBRARY) { // Add the interface library as an item so it can be considered as part // of COMPATIBLE_INTERFACE_ enforcement. The generators will ignore @@ -674,12 +672,12 @@ void cmComputeLinkInformation::AddItem(std::string const& item, // Decide whether to use an import library. bool implib = (this->UseImportLibrary && - (impexe || tgt->GetType() == cmTarget::SHARED_LIBRARY)); + (impexe || tgt->GetType() == cmState::SHARED_LIBRARY)); // Pass the full path to the target file. - std::string lib = gtgt->GetFullPath(config, implib, true); + std::string lib = tgt->GetFullPath(config, implib, true); if(!this->LinkDependsNoShared || - tgt->GetType() != cmTarget::SHARED_LIBRARY) + tgt->GetType() != cmState::SHARED_LIBRARY) { this->Depends.push_back(lib); } @@ -716,7 +714,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item, //---------------------------------------------------------------------------- void cmComputeLinkInformation::AddSharedDepItem(std::string const& item, - cmTarget const* tgt) + const cmGeneratorTarget* tgt) { // If dropping shared library dependencies, ignore them. if(this->SharedDependencyMode == SharedDepModeNone) @@ -730,7 +728,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item, { // The target will provide a full path. Make sure it is a shared // library. - if(tgt->GetType() != cmTarget::SHARED_LIBRARY) + if(tgt->GetType() != cmState::SHARED_LIBRARY) { return; } @@ -760,17 +758,13 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item, return; } - cmGeneratorTarget *gtgt = 0; - // Get a full path to the dependent shared library. // Add it to the runtime path computation so that the target being // linked will be able to find it. std::string lib; if(tgt) { - gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt); - - lib = gtgt->GetFullPath(this->Config, this->UseImportLibrary); + lib = tgt->GetFullPath(this->Config, this->UseImportLibrary); this->AddLibraryRuntimeInfo(lib, tgt); } else @@ -795,9 +789,9 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item, } if(order) { - if(gtgt) + if(tgt) { - std::string soName = gtgt->GetSOName(this->Config); + std::string soName = tgt->GetSOName(this->Config); const char* soname = soName.empty()? 0 : soName.c_str(); order->AddRuntimeLibrary(lib, soname); } @@ -824,9 +818,9 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo() const char* target_type_str = 0; switch(this->Target->GetType()) { - case cmTarget::EXECUTABLE: target_type_str = "EXE"; break; - case cmTarget::SHARED_LIBRARY: target_type_str = "SHARED_LIBRARY"; break; - case cmTarget::MODULE_LIBRARY: target_type_str = "SHARED_MODULE"; break; + case cmState::EXECUTABLE: target_type_str = "EXE"; break; + case cmState::SHARED_LIBRARY: target_type_str = "SHARED_LIBRARY"; break; + case cmState::MODULE_LIBRARY: target_type_str = "SHARED_MODULE"; break; default: break; } if(target_type_str) @@ -860,7 +854,7 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo() // Lookup the starting link type from the target (linked statically?). const char* lss = - this->Target->Target->GetProperty("LINK_SEARCH_START_STATIC"); + this->Target->GetProperty("LINK_SEARCH_START_STATIC"); this->StartLinkType = cmSystemTools::IsOn(lss)? LinkStatic : LinkShared; this->CurrentLinkType = this->StartLinkType; } @@ -1082,7 +1076,7 @@ void cmComputeLinkInformation::SetCurrentLinkType(LinkType lt) //---------------------------------------------------------------------------- void cmComputeLinkInformation::AddTargetItem(std::string const& item, - cmTarget const* target) + cmGeneratorTarget const* target) { // This is called to handle a link item that is a full path to a target. // If the target is not a static library make sure the link type is @@ -1090,13 +1084,13 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item, // shared and static libraries but static-mode can handle only // static libraries. If a previous user item changed the link type // to static we need to make sure it is back to shared. - if(target->GetType() != cmTarget::STATIC_LIBRARY) + if(target->GetType() != cmState::STATIC_LIBRARY) { this->SetCurrentLinkType(LinkShared); } // Keep track of shared library targets linked. - if(target->GetType() == cmTarget::SHARED_LIBRARY) + if(target->GetType() == cmState::SHARED_LIBRARY) { this->SharedLibrariesLinked.insert(target); } @@ -1146,7 +1140,7 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item) // Full path libraries should specify a valid library file name. // See documentation of CMP0008. std::string generator = this->GlobalGenerator->GetName(); - if(this->Target->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW && + if(this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW && (generator.find("Visual Studio") != generator.npos || generator.find("Xcode") != generator.npos)) { @@ -1227,7 +1221,7 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item) } // Check the policy for whether we should use the approach below. - switch (this->Target->Target->GetPolicyStatusCMP0060()) + switch (this->Target->GetPolicyStatusCMP0060()) { case cmPolicies::WARN: if (this->CMP0060Warn) @@ -1537,7 +1531,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, this->OrderLinkerSearchPath->AddLinkLibrary(item); // Produce any needed message. - switch(this->Target->Target->GetPolicyStatusCMP0008()) + switch(this->Target->GetPolicyStatusCMP0008()) { case cmPolicies::WARN: { @@ -1554,7 +1548,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, << " " << item << "\n" << "which is a full-path but not a valid library file name."; this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), - this->Target->Target->GetBacktrace()); + this->Target->GetBacktrace()); } } case cmPolicies::OLD: @@ -1572,7 +1566,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, << " " << item << "\n" << "which is a full-path but not a valid library file name."; this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), - this->Target->Target->GetBacktrace()); + this->Target->GetBacktrace()); } break; } @@ -1589,7 +1583,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories() } // Enforce policy constraints. - switch(this->Target->Target->GetPolicyStatusCMP0003()) + switch(this->Target->GetPolicyStatusCMP0003()) { case cmPolicies::WARN: if(!this->CMakeInstance->GetState() @@ -1600,7 +1594,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories() std::ostringstream w; this->PrintLinkPolicyDiagnosis(w); this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), - this->Target->Target->GetBacktrace()); + this->Target->GetBacktrace()); } case cmPolicies::OLD: // OLD behavior is to add the paths containing libraries with @@ -1616,7 +1610,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories() e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0003) << "\n"; this->PrintLinkPolicyDiagnosis(e); this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), - this->Target->Target->GetBacktrace()); + this->Target->GetBacktrace()); return false; } } @@ -1781,7 +1775,7 @@ cmComputeLinkInformation::GetRuntimeSearchPath() //---------------------------------------------------------------------------- void cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath, - cmTarget const* target) + cmGeneratorTarget const* target) { // Ignore targets on Apple where install_name is not @rpath. // The dependenty library can be found with other means such as @@ -1796,22 +1790,21 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath, // Libraries with unknown type must be handled using just the file // on disk. - if(target->GetType() == cmTarget::UNKNOWN_LIBRARY) + if(target->GetType() == cmState::UNKNOWN_LIBRARY) { this->AddLibraryRuntimeInfo(fullPath); return; } // Skip targets that are not shared libraries (modules cannot be linked). - if(target->GetType() != cmTarget::SHARED_LIBRARY) + if(target->GetType() != cmState::SHARED_LIBRARY) { return; } // Try to get the soname of the library. Only files with this name // could possibly conflict. - cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(target); - std::string soName = gtgt->GetSOName(this->Config); + std::string soName = target->GetSOName(this->Config); const char* soname = soName.empty()? 0 : soName.c_str(); // Include this library in the runtime path ordering. @@ -1918,9 +1911,9 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, // build tree. bool linking_for_install = (for_install || - this->Target->Target->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH")); + this->Target->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH")); bool use_install_rpath = - (outputRuntime && this->Target->Target->HaveInstallTreeRPATH() && + (outputRuntime && this->Target->HaveInstallTreeRPATH() && linking_for_install); bool use_build_rpath = (outputRuntime && this->Target->HaveBuildTreeRPATH(this->Config) && @@ -1928,14 +1921,14 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, bool use_link_rpath = outputRuntime && linking_for_install && !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH") && - this->Target->Target->GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH"); + this->Target->GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH"); // Construct the RPATH. std::set emitted; if(use_install_rpath) { const char* install_rpath = - this->Target->Target->GetProperty("INSTALL_RPATH"); + this->Target->GetProperty("INSTALL_RPATH"); cmCLI_ExpandListUnique(install_rpath, runtimeDirs, emitted); } if(use_build_rpath || use_link_rpath) @@ -1975,8 +1968,9 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, else if(use_link_rpath) { // Do not add any path inside the source or build tree. - const char* topSourceDir = this->Makefile->GetHomeDirectory(); - const char* topBinaryDir = this->Makefile->GetHomeOutputDirectory(); + const char* topSourceDir = this->CMakeInstance->GetHomeDirectory(); + const char* topBinaryDir = + this->CMakeInstance->GetHomeOutputDirectory(); if(!cmSystemTools::ComparePath(*ri, topSourceDir) && !cmSystemTools::ComparePath(*ri, topBinaryDir) && !cmSystemTools::IsSubDirectory(*ri, topSourceDir) && diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 8b8357459..5eecf7dcb 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -19,7 +19,6 @@ class cmake; class cmGlobalGenerator; class cmMakefile; -class cmTarget; class cmGeneratorTarget; class cmOrderDirectories; @@ -39,11 +38,11 @@ public: Item(): Value(), IsPath(true), Target(0) {} Item(Item const& item): Value(item.Value), IsPath(item.IsPath), Target(item.Target) {} - Item(std::string const& v, bool p, cmTarget const* target = 0): + Item(std::string const& v, bool p, cmGeneratorTarget const* target = 0): Value(v), IsPath(p), Target(target) {} std::string Value; bool IsPath; - cmTarget const* Target; + cmGeneratorTarget const* Target; }; typedef std::vector ItemVector; ItemVector const& GetItems(); @@ -57,13 +56,13 @@ public: void GetRPath(std::vector& runtimeDirs, bool for_install); std::string GetRPathString(bool for_install); std::string GetChrpathString(); - std::set const& GetSharedLibrariesLinked(); + std::set const& GetSharedLibrariesLinked(); std::string const& GetRPathLinkFlag() const { return this->RPathLinkFlag; } std::string GetRPathLinkString(); private: - void AddItem(std::string const& item, cmTarget const* tgt); - void AddSharedDepItem(std::string const& item, cmTarget const* tgt); + void AddItem(std::string const& item, const cmGeneratorTarget* tgt); + void AddSharedDepItem(std::string const& item, cmGeneratorTarget const* tgt); // Output information. ItemVector Items; @@ -71,7 +70,7 @@ private: std::vector Depends; std::vector FrameworkPaths; std::vector RuntimeSearchPath; - std::set SharedLibrariesLinked; + std::set SharedLibrariesLinked; // Context information. cmGeneratorTarget const* Target; @@ -129,7 +128,7 @@ private: std::string NoCaseExpression(const char* str); // Handling of link items. - void AddTargetItem(std::string const& item, cmTarget const* target); + void AddTargetItem(std::string const& item, const cmGeneratorTarget* target); void AddFullItem(std::string const& item); bool CheckImplicitDirItem(std::string const& item); void AddUserItem(std::string const& item, bool pathNotKnown); @@ -183,7 +182,7 @@ private: bool CMP0060Warn; void AddLibraryRuntimeInfo(std::string const& fullPath, - cmTarget const* target); + const cmGeneratorTarget* target); void AddLibraryRuntimeInfo(std::string const& fullPath); }; diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 9e37c3512..586b5bfb1 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -175,13 +175,12 @@ void cmComputeTargetDepends::CollectTargets() this->GlobalGenerator->GetLocalGenerators(); for(unsigned int i = 0; i < lgens.size(); ++i) { - const cmTargets& targets = lgens[i]->GetMakefile()->GetTargets(); - for(cmTargets::const_iterator ti = targets.begin(); + const std::vector targets = + lgens[i]->GetGeneratorTargets(); + for(std::vector::const_iterator ti = targets.begin(); ti != targets.end(); ++ti) { - cmTarget const* target = &ti->second; - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(target); + cmGeneratorTarget* gt = *ti; int index = static_cast(this->Targets.size()); this->TargetIndex[gt] = index; this->Targets.push_back(gt); @@ -207,7 +206,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) { // Get the depender. cmGeneratorTarget const* depender = this->Targets[depender_index]; - if (depender->GetType() == cmTarget::INTERFACE_LIBRARY) + if (depender->GetType() == cmState::INTERFACE_LIBRARY) { return; } @@ -236,16 +235,16 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) std::string objLib = (*oi)->GetObjectLibrary(); if (!objLib.empty() && emitted.insert(objLib).second) { - if(depender->GetType() != cmTarget::EXECUTABLE && - depender->GetType() != cmTarget::STATIC_LIBRARY && - depender->GetType() != cmTarget::SHARED_LIBRARY && - depender->GetType() != cmTarget::MODULE_LIBRARY) + if(depender->GetType() != cmState::EXECUTABLE && + depender->GetType() != cmState::STATIC_LIBRARY && + depender->GetType() != cmState::SHARED_LIBRARY && + depender->GetType() != cmState::MODULE_LIBRARY) { this->GlobalGenerator->GetCMakeInstance() ->IssueMessage(cmake::FATAL_ERROR, "Only executables and non-OBJECT libraries may " "reference target objects.", - depender->Target->GetBacktrace()); + depender->GetBacktrace()); return; } const_cast(depender)->Target->AddUtility(objLib); @@ -272,7 +271,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Loop over all utility dependencies. { - std::set const& tutils = depender->Target->GetUtilityItems(); + std::set const& tutils = depender->GetUtilityItems(); std::set emitted; // A target should not depend on itself. emitted.insert(depender->GetName()); @@ -297,7 +296,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, cmGeneratorTarget const* depender = this->Targets[depender_index]; if(cmLinkInterface const* iface = dependee->GetLinkInterface(config, - depender->Target)) + depender)) { for(std::vector::const_iterator lib = iface->Libraries.begin(); @@ -319,12 +318,12 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, std::set &emitted) { cmGeneratorTarget const* depender = this->Targets[depender_index]; - cmTarget const* dependee = dependee_name.Target; + cmGeneratorTarget const* dependee = dependee_name.Target; // Skip targets that will not really be linked. This is probably a // name conflict between an external library and an executable // within the project. if(dependee && - dependee->GetType() == cmTarget::EXECUTABLE && + dependee->GetType() == cmState::EXECUTABLE && !dependee->IsExecutableWithExports()) { dependee = 0; @@ -332,9 +331,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, if(dependee) { - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(dependee); - this->AddInterfaceDepends(depender_index, gt, "", emitted); + this->AddInterfaceDepends(depender_index, dependee, "", emitted); std::vector configs; depender->Makefile->GetConfigurations(configs); for (std::vector::const_iterator it = configs.begin(); @@ -342,7 +339,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, { // A target should not depend on itself. emitted.insert(depender->GetName()); - this->AddInterfaceDepends(depender_index, gt, *it, emitted); + this->AddInterfaceDepends(depender_index, dependee, *it, emitted); } } } @@ -356,15 +353,15 @@ void cmComputeTargetDepends::AddTargetDepend( cmGeneratorTarget const* depender = this->Targets[depender_index]; // Check the target's makefile first. - cmTarget const* dependee = dependee_name.Target; + cmGeneratorTarget const* dependee = dependee_name.Target; if(!dependee && !linking && - (depender->GetType() != cmTarget::GLOBAL_TARGET)) + (depender->GetType() != cmState::GLOBAL_TARGET)) { cmake::MessageType messageType = cmake::AUTHOR_WARNING; bool issueMessage = false; std::ostringstream e; - switch(depender->Target->GetPolicyStatusCMP0046()) + switch(depender->GetPolicyStatusCMP0046()) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0046) << "\n"; @@ -385,7 +382,7 @@ void cmComputeTargetDepends::AddTargetDepend( << "\" of target \"" << depender->GetName() << "\" does not exist."; cmListFileBacktrace const* backtrace = - depender->Target->GetUtilityBacktrace(dependee_name); + depender->GetUtilityBacktrace(dependee_name); if(backtrace) { cm->IssueMessage(messageType, e.str(), *backtrace); @@ -402,7 +399,7 @@ void cmComputeTargetDepends::AddTargetDepend( // name conflict between an external library and an executable // within the project. if(linking && dependee && - dependee->GetType() == cmTarget::EXECUTABLE && + dependee->GetType() == cmState::EXECUTABLE && !dependee->IsExecutableWithExports()) { dependee = 0; @@ -410,9 +407,7 @@ void cmComputeTargetDepends::AddTargetDepend( if(dependee) { - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(dependee); - this->AddTargetDepend(depender_index, gt, linking); + this->AddTargetDepend(depender_index, dependee, linking); } } @@ -421,20 +416,18 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, const cmGeneratorTarget* dependee, bool linking) { - if(dependee->Target->IsImported() || - dependee->GetType() == cmTarget::INTERFACE_LIBRARY) + if(dependee->IsImported() || + dependee->GetType() == cmState::INTERFACE_LIBRARY) { // Skip IMPORTED and INTERFACE targets but follow their utility // dependencies. - std::set const& utils = dependee->Target->GetUtilityItems(); + std::set const& utils = dependee->GetUtilityItems(); for(std::set::const_iterator i = utils.begin(); i != utils.end(); ++i) { - if(cmTarget const* transitive_dependee = i->Target) + if(cmGeneratorTarget const* transitive_dependee = i->Target) { - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(transitive_dependee); - this->AddTargetDepend(depender_index, gt, false); + this->AddTargetDepend(depender_index, transitive_dependee, false); } } } @@ -529,7 +522,7 @@ cmComputeTargetDepends // Make sure the component is all STATIC_LIBRARY targets. for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { - if(this->Targets[*ni]->GetType() != cmTarget::STATIC_LIBRARY) + if(this->Targets[*ni]->GetType() != cmState::STATIC_LIBRARY) { this->ComplainAboutBadComponent(ccg, c); return false; @@ -560,7 +553,7 @@ cmComputeTargetDepends // Describe the depender. e << " \"" << depender->GetName() << "\" of type " - << cmTarget::GetTargetTypeName(depender->Target->GetType()) << "\n"; + << cmState::GetTargetTypeName(depender->GetType()) << "\n"; // List its dependencies that are inside the component. EdgeList const& nl = this->InitialGraph[i]; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 3d9c4bf0a..4a1f770ba 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -34,7 +34,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) std::string outputVariable; std::string copyFile; std::string copyFileError; - std::vector targets; + std::vector targets; std::string libsToLink = " "; bool useOldLinkLibs = true; char targetNameBuf[64]; @@ -93,12 +93,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) { switch(tgt->GetType()) { - case cmTarget::SHARED_LIBRARY: - case cmTarget::STATIC_LIBRARY: - case cmTarget::INTERFACE_LIBRARY: - case cmTarget::UNKNOWN_LIBRARY: + case cmState::SHARED_LIBRARY: + case cmState::STATIC_LIBRARY: + case cmState::INTERFACE_LIBRARY: + case cmState::UNKNOWN_LIBRARY: break; - case cmTarget::EXECUTABLE: + case cmState::EXECUTABLE: if (tgt->IsExecutableWithExports()) { break; @@ -107,12 +107,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) this->Makefile->IssueMessage(cmake::FATAL_ERROR, "Only libraries may be used as try_compile or try_run IMPORTED " "LINK_LIBRARIES. Got " + std::string(tgt->GetName()) + " of " - "type " + tgt->GetTargetTypeName(tgt->GetType()) + "."); + "type " + cmState::GetTargetTypeName(tgt->GetType()) + "."); return -1; } if (tgt->IsImported()) { - targets.push_back(tgt); + targets.push_back(argv[i]); } } } @@ -375,9 +375,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) if (!targets.empty()) { std::string fname = "/" + std::string(targetName) + "Targets.cmake"; - cmExportTryCompileFileGenerator tcfg(gg); + cmExportTryCompileFileGenerator tcfg(gg, targets, this->Makefile); tcfg.SetExportFile((this->BinaryDirectory + fname).c_str()); - tcfg.SetExports(targets); tcfg.SetConfig(this->Makefile->GetSafeDefinition( "CMAKE_TRY_COMPILE_CONFIGURATION")); diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 7f3b65109..dc06678cf 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -43,15 +43,14 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { std::string const& argv0 = this->CC.GetCommandLines()[c][0]; cmGeneratorTarget* target = - this->LG->GetMakefile()->FindGeneratorTargetToUse(argv0); - if(target && target->GetType() == cmTarget::EXECUTABLE && - (target->Target->IsImported() + this->LG->FindGeneratorTargetToUse(argv0); + if(target && target->GetType() == cmState::EXECUTABLE && + (target->IsImported() || !this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING"))) { return target->GetLocation(this->Config); } - return this->GE->Parse(argv0)->Evaluate(this->LG->GetMakefile(), - this->Config); + return this->GE->Parse(argv0)->Evaluate(this->LG, this->Config); } //---------------------------------------------------------------------------- @@ -92,7 +91,7 @@ cmCustomCommandGenerator for(unsigned int j=1;j < commandLine.size(); ++j) { std::string arg = - this->GE->Parse(commandLine[j])->Evaluate(this->LG->GetMakefile(), + this->GE->Parse(commandLine[j])->Evaluate(this->LG, this->Config); cmd += " "; if(this->OldStyle) @@ -101,7 +100,7 @@ cmCustomCommandGenerator } else { - cmOutputConverter converter(this->LG->GetMakefile()->GetStateSnapshot()); + cmOutputConverter converter(this->LG->GetStateSnapshot()); cmd += converter.EscapeForShell(arg, this->MakeVars); } } @@ -146,7 +145,7 @@ std::vector const& cmCustomCommandGenerator::GetDepends() const = this->GE->Parse(*i); std::vector result; cmSystemTools::ExpandListArgument( - cge->Evaluate(this->LG->GetMakefile(), this->Config), result); + cge->Evaluate(this->LG, this->Config), result); for (std::vector::iterator it = result.begin(); it != result.end(); ++it) { diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 856dcd429..80f560f31 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -160,7 +160,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, if (mod_dir.empty()) { mod_dir = - this->LocalGenerator->GetMakefile()->GetCurrentBinaryDirectory(); + this->LocalGenerator->GetCurrentBinaryDirectory(); } // Actually write dependencies to the streams. diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index d062987b1..37dd328db 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -567,8 +567,14 @@ bool cmELFInternalImpl::LoadDynamicSection() return true; } - // Allocate the dynamic section entries. + // If there are no entries we are done. ELF_Shdr const& sec = this->SectionHeaders[this->DynamicSectionIndex]; + if(sec.sh_entsize == 0) + { + return false; + } + + // Allocate the dynamic section entries. int n = static_cast(sec.sh_size / sec.sh_entsize); this->DynamicSectionEntries.resize(n); diff --git a/Source/cmEnableTestingCommand.cxx b/Source/cmEnableTestingCommand.cxx index aa41ef73b..6a7fd4692 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/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index fed0dbc90..dcb21876c 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -18,16 +18,24 @@ //---------------------------------------------------------------------------- cmExportBuildFileGenerator::cmExportBuildFileGenerator() - : Backtrace() { - this->Makefile = 0; + this->LG = 0; this->ExportSet = 0; } +//---------------------------------------------------------------------------- +void cmExportBuildFileGenerator::Compute(cmLocalGenerator* lg) +{ + this->LG = lg; + if (this->ExportSet) + { + this->ExportSet->Compute(lg); + } +} + //---------------------------------------------------------------------------- bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) { - std::vector allTargets; { std::string expectedTargets; std::string sep; @@ -37,11 +45,11 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) tei = targets.begin(); tei != targets.end(); ++tei) { - cmGeneratorTarget *te = this->Makefile + cmGeneratorTarget *te = this->LG ->FindGeneratorTargetToUse(*tei); - expectedTargets += sep + this->Namespace + te->Target->GetExportName(); + expectedTargets += sep + this->Namespace + te->GetExportName(); sep = " "; - if(this->ExportedTargets.insert(te->Target).second) + if(this->ExportedTargets.insert(te).second) { this->Exports.push_back(te); } @@ -49,11 +57,12 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) { std::ostringstream e; e << "given target \"" << te->GetName() << "\" more than once."; - this->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Backtrace); + this->LG->GetGlobalGenerator()->GetCMakeInstance() + ->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->LG->GetMakefile()->GetBacktrace()); return false; } - if (te->GetType() == cmTarget::INTERFACE_LIBRARY) + if (te->GetType() == cmState::INTERFACE_LIBRARY) { this->GenerateRequiredCMakeVersion(os, "3.0.0"); } @@ -70,45 +79,44 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) tei != this->Exports.end(); ++tei) { cmGeneratorTarget* gte = *tei; - cmTarget* te = gte->Target; - this->GenerateImportTargetCode(os, te); + this->GenerateImportTargetCode(os, gte); - te->AppendBuildInterfaceIncludes(); + gte->Target->AppendBuildInterfaceIncludes(); ImportPropertyMap properties; - this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES", te, + this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES", gte, cmGeneratorExpression::BuildInterface, properties, missingTargets); - this->PopulateInterfaceProperty("INTERFACE_SOURCES", te, + this->PopulateInterfaceProperty("INTERFACE_SOURCES", gte, cmGeneratorExpression::BuildInterface, properties, missingTargets); - this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", te, + this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", gte, cmGeneratorExpression::BuildInterface, properties, missingTargets); - this->PopulateInterfaceProperty("INTERFACE_COMPILE_OPTIONS", te, + this->PopulateInterfaceProperty("INTERFACE_COMPILE_OPTIONS", gte, cmGeneratorExpression::BuildInterface, properties, missingTargets); - this->PopulateInterfaceProperty("INTERFACE_AUTOUIC_OPTIONS", te, + this->PopulateInterfaceProperty("INTERFACE_AUTOUIC_OPTIONS", gte, cmGeneratorExpression::BuildInterface, properties, missingTargets); - this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", te, + this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", gte, cmGeneratorExpression::BuildInterface, properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", - te, properties); + gte, properties); const bool newCMP0022Behavior = - te->GetPolicyStatusCMP0022() != cmPolicies::WARN - && te->GetPolicyStatusCMP0022() != cmPolicies::OLD; + gte->GetPolicyStatusCMP0022() != cmPolicies::WARN + && gte->GetPolicyStatusCMP0022() != cmPolicies::OLD; if (newCMP0022Behavior) { - this->PopulateInterfaceLinkLibrariesProperty(te, + this->PopulateInterfaceLinkLibrariesProperty(gte, cmGeneratorExpression::BuildInterface, properties, missingTargets); } this->PopulateCompatibleInterfaceProperties(gte, properties); - this->GenerateInterfaceProperties(te, os, properties); + this->GenerateInterfaceProperties(gte, os, properties); } // Generate import file content for each configuration. @@ -140,14 +148,14 @@ cmExportBuildFileGenerator cmGeneratorTarget* target = *tei; ImportPropertyMap properties; - if (target->GetType() != cmTarget::INTERFACE_LIBRARY) + if (target->GetType() != cmState::INTERFACE_LIBRARY) { this->SetImportLocationProperty(config, suffix, target, properties); } if(!properties.empty()) { // Get the rest of the target details. - if (target->GetType() != cmTarget::INTERFACE_LIBRARY) + if (target->GetType() != cmState::INTERFACE_LIBRARY) { this->SetImportDetailProperties(config, suffix, target, @@ -165,7 +173,7 @@ cmExportBuildFileGenerator // properties); // Generate code in the export file. - this->GenerateImportPropertyCode(os, config, target->Target, + this->GenerateImportPropertyCode(os, config, target, properties); } } @@ -193,7 +201,7 @@ cmExportBuildFileGenerator std::string prop = "IMPORTED_LOCATION"; prop += suffix; std::string value; - if(target->Target->IsAppBundleOnApple()) + if(target->IsAppBundleOnApple()) { value = target->GetFullPath(config, false); } @@ -204,20 +212,16 @@ cmExportBuildFileGenerator properties[prop] = value; } - // Check whether this is a DLL platform. - bool dll_platform = - (mf->IsOn("WIN32") || mf->IsOn("CYGWIN") || mf->IsOn("MINGW")); - // Add the import library for windows DLLs. - if(dll_platform && - (target->GetType() == cmTarget::SHARED_LIBRARY || - target->Target->IsExecutableWithExports()) && + if(target->IsDLLPlatform() && + (target->GetType() == cmState::SHARED_LIBRARY || + target->IsExecutableWithExports()) && mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) { std::string prop = "IMPORTED_IMPLIB"; prop += suffix; std::string value = target->GetFullPath(config, true); - target->Target->GetImplibGNUtoMS(value, value, + target->GetImplibGNUtoMS(value, value, "${CMAKE_IMPORT_LIBRARY_SUFFIX}"); properties[prop] = value; } @@ -226,14 +230,18 @@ cmExportBuildFileGenerator //---------------------------------------------------------------------------- void cmExportBuildFileGenerator::HandleMissingTarget( - std::string& link_libs, std::vector& missingTargets, - cmMakefile* mf, cmTarget* depender, cmTarget* dependee) + std::string& link_libs, + std::vector& missingTargets, + cmGeneratorTarget* depender, + cmGeneratorTarget* dependee) { // The target is not in the export. if(!this->AppendMode) { const std::string name = dependee->GetName(); - std::vector namespaces = this->FindNamespaces(mf, name); + cmGlobalGenerator* gg = + dependee->GetLocalGenerator()->GetGlobalGenerator(); + std::vector namespaces = this->FindNamespaces(gg, name); int targetOccurrences = (int)namespaces.size(); if (targetOccurrences == 1) @@ -268,7 +276,7 @@ void cmExportBuildFileGenerator tei = this->ExportSet->GetTargetExports()->begin(); tei != this->ExportSet->GetTargetExports()->end(); ++tei) { - targets.push_back((*tei)->Target->GetName()); + targets.push_back((*tei)->TargetName); } return; } @@ -278,10 +286,9 @@ void cmExportBuildFileGenerator //---------------------------------------------------------------------------- std::vector cmExportBuildFileGenerator -::FindNamespaces(cmMakefile* mf, const std::string& name) +::FindNamespaces(cmGlobalGenerator* gg, const std::string& name) { std::vector namespaces; - cmGlobalGenerator* gg = mf->GetGlobalGenerator(); std::map& exportSets = gg->GetBuildExportSets(); @@ -304,8 +311,8 @@ cmExportBuildFileGenerator //---------------------------------------------------------------------------- void cmExportBuildFileGenerator -::ComplainAboutMissingTarget(cmTarget* depender, - cmTarget* dependee, +::ComplainAboutMissingTarget(cmGeneratorTarget* depender, + cmGeneratorTarget* dependee, int occurrences) { if(cmSystemTools::GetErrorOccuredFlag()) @@ -328,8 +335,9 @@ cmExportBuildFileGenerator e << "If the required target is not easy to reference in this call, " << "consider using the APPEND option with multiple separate calls."; - this->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Backtrace); + this->LG->GetGlobalGenerator()->GetCMakeInstance() + ->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->LG->GetMakefile()->GetBacktrace()); } std::string diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h index ff3d2e1a9..85aae2fa4 100644 --- a/Source/cmExportBuildFileGenerator.h +++ b/Source/cmExportBuildFileGenerator.h @@ -43,10 +43,7 @@ public: /** Set whether to append generated code to the output file. */ void SetAppendMode(bool append) { this->AppendMode = append; } - void SetMakefile(cmMakefile *mf) { - this->Makefile = mf; - this->Backtrace = this->Makefile->GetBacktrace(); - } + void Compute(cmLocalGenerator* lg); protected: // Implement virtual methods from the superclass. @@ -57,12 +54,11 @@ protected: std::vector &missingTargets); virtual void HandleMissingTarget(std::string& link_libs, std::vector& missingTargets, - cmMakefile* mf, - cmTarget* depender, - cmTarget* dependee); + cmGeneratorTarget* depender, + cmGeneratorTarget* dependee); - void ComplainAboutMissingTarget(cmTarget* depender, - cmTarget* dependee, + void ComplainAboutMissingTarget(cmGeneratorTarget* depender, + cmGeneratorTarget* dependee, int occurrences); /** Fill in properties indicating built file locations. */ @@ -75,13 +71,12 @@ protected: const std::string& config); std::vector - FindNamespaces(cmMakefile* mf, const std::string& name); + FindNamespaces(cmGlobalGenerator* gg, const std::string& name); std::vector Targets; cmExportSet *ExportSet; std::vector Exports; - cmMakefile* Makefile; - cmListFileBacktrace Backtrace; + cmLocalGenerator* LG; }; #endif diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 96ea77b2d..4eec66a33 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" @@ -169,7 +168,7 @@ bool cmExportCommand if(cmTarget* target = gg->FindTarget(*currentTarget)) { - if(target->GetType() == cmTarget::OBJECT_LIBRARY) + if(target->GetType() == cmState::OBJECT_LIBRARY) { std::ostringstream e; e << "given OBJECT library \"" << *currentTarget @@ -177,7 +176,7 @@ bool cmExportCommand this->SetError(e.str()); return false; } - if (target->GetType() == cmTarget::UTILITY) + if (target->GetType() == cmState::UTILITY) { this->SetError("given custom target \"" + *currentTarget + "\" which may not be exported."); @@ -222,7 +221,7 @@ bool cmExportCommand { ebfg->SetTargets(targets); } - ebfg->SetMakefile(this->Makefile); + this->Makefile->AddExportBuildFileGenerator(ebfg); ebfg->SetExportOld(this->ExportOld.IsEnabled()); // Compute the set of configurations exported. diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 9a7d73f4b..e8a2e6a52 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -18,7 +18,6 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSystemTools.h" -#include "cmTarget.h" #include "cmTargetExport.h" #include "cmVersion.h" #include "cmComputeLinkInformation.h" @@ -155,7 +154,7 @@ void cmExportFileGenerator::GenerateImportConfig(std::ostream& os, //---------------------------------------------------------------------------- void cmExportFileGenerator::PopulateInterfaceProperty( const std::string& propName, - cmTarget *target, + cmGeneratorTarget *target, ImportPropertyMap &properties) { const char *input = target->GetProperty(propName); @@ -169,7 +168,7 @@ void cmExportFileGenerator::PopulateInterfaceProperty( void cmExportFileGenerator::PopulateInterfaceProperty( const std::string& propName, const std::string& outputName, - cmTarget *target, + cmGeneratorTarget *target, cmGeneratorExpression::PreprocessContext preprocessRule, ImportPropertyMap &properties, std::vector &missingTargets) @@ -206,7 +205,7 @@ void cmExportFileGenerator::GenerateRequiredCMakeVersion(std::ostream& os, //---------------------------------------------------------------------------- bool cmExportFileGenerator::PopulateInterfaceLinkLibrariesProperty( - cmTarget *target, + cmGeneratorTarget *target, cmGeneratorExpression::PreprocessContext preprocessRule, ImportPropertyMap &properties, std::vector &missingTargets) @@ -241,12 +240,14 @@ static bool isSubDirectory(const char* a, const char* b) //---------------------------------------------------------------------------- static bool checkInterfaceDirs(const std::string &prepro, - cmTarget *target, const std::string& prop) + cmGeneratorTarget *target, const std::string& prop) { const char* installDir = - target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX"); - const char* topSourceDir = target->GetMakefile()->GetHomeDirectory(); - const char* topBinaryDir = target->GetMakefile()->GetHomeOutputDirectory(); + target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX"); + const char* topSourceDir = + target->GetLocalGenerator()->GetSourceDirectory(); + const char* topBinaryDir = + target->GetLocalGenerator()->GetBinaryDirectory(); std::vector parts; cmGeneratorExpression::Split(prepro, parts); @@ -298,7 +299,7 @@ static bool checkInterfaceDirs(const std::string &prepro, e << "Target \"" << target->GetName() << "\" " << prop << " property contains relative path:\n" " \"" << *li << "\""; - target->GetMakefile()->IssueMessage(messageType, e.str()); + target->GetLocalGenerator()->IssueMessage(messageType, e.str()); } bool inBinary = isSubDirectory(li->c_str(), topBinaryDir); bool inSource = isSubDirectory(li->c_str(), topSourceDir); @@ -329,7 +330,7 @@ static bool checkInterfaceDirs(const std::string &prepro, "a subdirectory of the " << (inBinary ? "build" : "source") << " tree:\n \"" << (inBinary ? topBinaryDir : topSourceDir) << "\"" << std::endl; - target->GetMakefile()->IssueMessage(cmake::AUTHOR_WARNING, + target->GetLocalGenerator()->IssueMessage(cmake::AUTHOR_WARNING, s.str()); } case cmPolicies::OLD: @@ -352,7 +353,7 @@ static bool checkInterfaceDirs(const std::string &prepro, e << "Target \"" << target->GetName() << "\" " << prop << " property contains path:\n" " \"" << *li << "\"\nwhich is prefixed in the build directory."; - target->GetMakefile()->IssueMessage(messageType, e.str()); + target->GetLocalGenerator()->IssueMessage(messageType, e.str()); } if (!inSourceBuild) { @@ -361,7 +362,7 @@ static bool checkInterfaceDirs(const std::string &prepro, e << "Target \"" << target->GetName() << "\" " << prop << " property contains path:\n" " \"" << *li << "\"\nwhich is prefixed in the source directory."; - target->GetMakefile()->IssueMessage(messageType, e.str()); + target->GetLocalGenerator()->IssueMessage(messageType, e.str()); } } } @@ -396,11 +397,11 @@ void cmExportFileGenerator::PopulateSourcesInterface( ImportPropertyMap &properties, std::vector &missingTargets) { - cmTarget *target = tei->Target; + cmGeneratorTarget* gt = tei->Target; assert(preprocessRule == cmGeneratorExpression::InstallInterface); const char *propName = "INTERFACE_SOURCES"; - const char *input = target->GetProperty(propName); + const char *input = gt->GetProperty(propName); if (!input) { @@ -418,10 +419,10 @@ void cmExportFileGenerator::PopulateSourcesInterface( true); if (!prepro.empty()) { - this->ResolveTargetsInGeneratorExpressions(prepro, target, + this->ResolveTargetsInGeneratorExpressions(prepro, gt, missingTargets); - if (!checkInterfaceDirs(prepro, target, propName)) + if (!checkInterfaceDirs(prepro, gt, propName)) { return; } @@ -436,7 +437,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( ImportPropertyMap &properties, std::vector &missingTargets) { - cmTarget *target = tei->Target; + cmGeneratorTarget *target = tei->Target; assert(preprocessRule == cmGeneratorExpression::InstallInterface); const char *propName = "INTERFACE_INCLUDE_DIRECTORIES"; @@ -450,18 +451,18 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( true); this->ReplaceInstallPrefix(dirs); cmsys::auto_ptr cge = ge.Parse(dirs); - std::string exportDirs = cge->Evaluate(target->GetMakefile(), "", + std::string exportDirs = cge->Evaluate(target->GetLocalGenerator(), "", false, target); if (cge->GetHadContextSensitiveCondition()) { - cmMakefile* mf = target->GetMakefile(); + cmLocalGenerator* lg = target->GetLocalGenerator(); std::ostringstream e; e << "Target \"" << target->GetName() << "\" is installed with " "INCLUDES DESTINATION set to a context sensitive path. Paths which " "depend on the configuration, policy values or the link interface are " "not supported. Consider using target_include_directories instead."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + lg->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -500,7 +501,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( //---------------------------------------------------------------------------- void cmExportFileGenerator::PopulateInterfaceProperty( const std::string& propName, - cmTarget *target, + cmGeneratorTarget* target, cmGeneratorExpression::PreprocessContext preprocessRule, ImportPropertyMap &properties, std::vector &missingTargets) @@ -511,8 +512,9 @@ void cmExportFileGenerator::PopulateInterfaceProperty( //---------------------------------------------------------------------------- -void getPropertyContents(cmTarget const* tgt, const std::string& prop, - std::set &ifaceProperties) +void getPropertyContents(cmGeneratorTarget const* tgt, + const std::string& prop, + std::set &ifaceProperties) { const char *p = tgt->GetProperty(prop); if (!p) @@ -533,11 +535,11 @@ void getCompatibleInterfaceProperties(cmGeneratorTarget *target, if (!info) { - cmMakefile* mf = target->Target->GetMakefile(); + cmLocalGenerator* lg = target->GetLocalGenerator(); std::ostringstream e; e << "Exporting the target \"" << target->GetName() << "\" is not " "allowed since its linker language cannot be determined"; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + lg->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -571,31 +573,30 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties( cmGeneratorTarget *gtarget, ImportPropertyMap &properties) { - cmTarget *target = gtarget->Target; this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_BOOL", - target, properties); + gtarget, properties); this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_STRING", - target, properties); + gtarget, properties); this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_NUMBER_MIN", - target, properties); + gtarget, properties); this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_NUMBER_MAX", - target, properties); + gtarget, properties); std::set ifaceProperties; - getPropertyContents(target, "COMPATIBLE_INTERFACE_BOOL", ifaceProperties); - getPropertyContents(target, "COMPATIBLE_INTERFACE_STRING", ifaceProperties); - getPropertyContents(target, "COMPATIBLE_INTERFACE_NUMBER_MIN", + getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_BOOL", ifaceProperties); + getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_STRING", ifaceProperties); + getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_NUMBER_MIN", ifaceProperties); - getPropertyContents(target, "COMPATIBLE_INTERFACE_NUMBER_MAX", + getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_NUMBER_MAX", ifaceProperties); - if (target->GetType() != cmTarget::INTERFACE_LIBRARY) + if (gtarget->GetType() != cmState::INTERFACE_LIBRARY) { getCompatibleInterfaceProperties(gtarget, ifaceProperties, ""); std::vector configNames; - target->GetMakefile()->GetConfigurations(configNames); + gtarget->Target->GetMakefile()->GetConfigurations(configNames); for (std::vector::const_iterator ci = configNames.begin(); ci != configNames.end(); ++ci) @@ -608,12 +609,13 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties( it != ifaceProperties.end(); ++it) { this->PopulateInterfaceProperty("INTERFACE_" + *it, - target, properties); + gtarget, properties); } } //---------------------------------------------------------------------------- -void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget const* target, +void cmExportFileGenerator::GenerateInterfaceProperties( + const cmGeneratorTarget* target, std::ostream& os, const ImportPropertyMap &properties) { @@ -635,12 +637,12 @@ void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget const* target, //---------------------------------------------------------------------------- bool cmExportFileGenerator::AddTargetNamespace(std::string &input, - cmTarget* target, + cmGeneratorTarget* target, std::vector &missingTargets) { - cmMakefile *mf = target->GetMakefile(); + cmLocalGenerator *lg = target->GetLocalGenerator(); - cmTarget *tgt = mf->FindTargetToUse(input); + cmGeneratorTarget *tgt = lg->FindGeneratorTargetToUse(input); if (!tgt) { return false; @@ -658,7 +660,7 @@ cmExportFileGenerator::AddTargetNamespace(std::string &input, { std::string namespacedTarget; this->HandleMissingTarget(namespacedTarget, missingTargets, - mf, target, tgt); + target, tgt); if (!namespacedTarget.empty()) { input = namespacedTarget; @@ -671,7 +673,7 @@ cmExportFileGenerator::AddTargetNamespace(std::string &input, void cmExportFileGenerator::ResolveTargetsInGeneratorExpressions( std::string &input, - cmTarget* target, + cmGeneratorTarget* target, std::vector &missingTargets, FreeTargetsReplace replace) { @@ -708,14 +710,12 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpressions( void cmExportFileGenerator::ResolveTargetsInGeneratorExpression( std::string &input, - cmTarget* target, + cmGeneratorTarget* target, std::vector &missingTargets) { std::string::size_type pos = 0; std::string::size_type lastPos = pos; - cmMakefile *mf = target->GetMakefile(); - while((pos = input.find("$IssueMessage(cmake::FATAL_ERROR, errorString); + target->GetLocalGenerator()->IssueMessage(cmake::FATAL_ERROR, errorString); } } @@ -797,7 +797,7 @@ cmExportFileGenerator { // Add the transitive link dependencies for this configuration. cmLinkInterface const* iface = target->GetLinkInterface(config, - target->Target); + target); if (!iface) { return; @@ -830,20 +830,18 @@ cmExportFileGenerator } const bool newCMP0022Behavior = - target->Target - ->GetPolicyStatusCMP0022() != cmPolicies::WARN - && target->Target - ->GetPolicyStatusCMP0022() != cmPolicies::OLD; + target->GetPolicyStatusCMP0022() != cmPolicies::WARN + && target->GetPolicyStatusCMP0022() != cmPolicies::OLD; if(newCMP0022Behavior && !this->ExportOld) { - cmMakefile *mf = target->Target->GetMakefile(); + cmLocalGenerator *lg = target->GetLocalGenerator(); std::ostringstream e; e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, " "but also has old-style LINK_INTERFACE_LIBRARIES properties " "populated, but it was exported without the " "EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties"; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + lg->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -857,7 +855,7 @@ cmExportFileGenerator preprocessRule); if (!prepro.empty()) { - this->ResolveTargetsInGeneratorExpressions(prepro, target->Target, + this->ResolveTargetsInGeneratorExpressions(prepro, target, missingTargets, ReplaceFreeTargets); properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = prepro; @@ -878,13 +876,10 @@ cmExportFileGenerator cmMakefile* mf = target->Makefile; // Add the soname for unix shared libraries. - if(target->GetType() == cmTarget::SHARED_LIBRARY || - target->GetType() == cmTarget::MODULE_LIBRARY) + if(target->GetType() == cmState::SHARED_LIBRARY || + target->GetType() == cmState::MODULE_LIBRARY) { - // Check whether this is a DLL platform. - bool dll_platform = - (mf->IsOn("WIN32") || mf->IsOn("CYGWIN") || mf->IsOn("MINGW")); - if(!dll_platform) + if(!target->IsDLLPlatform()) { std::string prop; std::string value; @@ -909,7 +904,7 @@ cmExportFileGenerator // Add the transitive link dependencies for this configuration. if(cmLinkInterface const* iface = - target->GetLinkInterface(config, target->Target)) + target->GetLinkInterface(config, target)) { this->SetImportLinkProperty(suffix, target, "IMPORTED_LINK_INTERFACE_LANGUAGES", @@ -959,7 +954,7 @@ cmExportFileGenerator sep = ";"; std::string temp = *li; - this->AddTargetNamespace(temp, target->Target, missingTargets); + this->AddTargetNamespace(temp, target, missingTargets); link_entries += temp; } @@ -1041,7 +1036,7 @@ void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os, //---------------------------------------------------------------------------- void cmExportFileGenerator -::GenerateImportTargetCode(std::ostream& os, cmTarget const* target) +::GenerateImportTargetCode(std::ostream& os, const cmGeneratorTarget* target) { // Construct the imported target name. std::string targetName = this->Namespace; @@ -1052,22 +1047,22 @@ cmExportFileGenerator os << "# Create imported target " << targetName << "\n"; switch(target->GetType()) { - case cmTarget::EXECUTABLE: + case cmState::EXECUTABLE: os << "add_executable(" << targetName << " IMPORTED)\n"; break; - case cmTarget::STATIC_LIBRARY: + case cmState::STATIC_LIBRARY: os << "add_library(" << targetName << " STATIC IMPORTED)\n"; break; - case cmTarget::SHARED_LIBRARY: + case cmState::SHARED_LIBRARY: os << "add_library(" << targetName << " SHARED IMPORTED)\n"; break; - case cmTarget::MODULE_LIBRARY: + case cmState::MODULE_LIBRARY: os << "add_library(" << targetName << " MODULE IMPORTED)\n"; break; - case cmTarget::UNKNOWN_LIBRARY: + case cmState::UNKNOWN_LIBRARY: os << "add_library(" << targetName << " UNKNOWN IMPORTED)\n"; break; - case cmTarget::INTERFACE_LIBRARY: + case cmState::INTERFACE_LIBRARY: os << "add_library(" << targetName << " INTERFACE IMPORTED)\n"; break; default: // should never happen @@ -1107,7 +1102,7 @@ cmExportFileGenerator void cmExportFileGenerator ::GenerateImportPropertyCode(std::ostream& os, const std::string& config, - cmTarget const* target, + cmGeneratorTarget const* target, ImportPropertyMap const& properties) { // Construct the imported target name. @@ -1227,7 +1222,7 @@ cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os) //---------------------------------------------------------------------------- void cmExportFileGenerator -::GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target, +::GenerateImportedFileChecksCode(std::ostream& os, cmGeneratorTarget* target, ImportPropertyMap const& properties, const std::set& importedLocations) { diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 44f779b67..18f0b009a 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -75,11 +75,13 @@ protected: const std::string& config = ""); void GenerateImportFooterCode(std::ostream& os); void GenerateImportVersionCode(std::ostream& os); - void GenerateImportTargetCode(std::ostream& os, cmTarget const* target); + void GenerateImportTargetCode(std::ostream& os, + cmGeneratorTarget const* target); void GenerateImportPropertyCode(std::ostream& os, const std::string& config, - cmTarget const* target, + cmGeneratorTarget const* target, ImportPropertyMap const& properties); - void GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target, + void GenerateImportedFileChecksCode(std::ostream& os, + cmGeneratorTarget* target, ImportPropertyMap const& properties, const std::set& importedLocations); void GenerateImportedFileCheckLoop(std::ostream& os); @@ -118,23 +120,24 @@ protected: * export set. */ virtual void HandleMissingTarget(std::string& link_libs, std::vector& missingTargets, - cmMakefile* mf, - cmTarget* depender, - cmTarget* dependee) = 0; + cmGeneratorTarget* depender, + cmGeneratorTarget* dependee) = 0; void PopulateInterfaceProperty(const std::string&, - cmTarget *target, + cmGeneratorTarget *target, cmGeneratorExpression::PreprocessContext, ImportPropertyMap &properties, std::vector &missingTargets); - bool PopulateInterfaceLinkLibrariesProperty(cmTarget *target, + bool PopulateInterfaceLinkLibrariesProperty(cmGeneratorTarget* target, cmGeneratorExpression::PreprocessContext, ImportPropertyMap &properties, std::vector &missingTargets); - void PopulateInterfaceProperty(const std::string& propName, cmTarget *target, + void PopulateInterfaceProperty(const std::string& propName, + cmGeneratorTarget* target, ImportPropertyMap &properties); void PopulateCompatibleInterfaceProperties(cmGeneratorTarget *target, ImportPropertyMap &properties); - void GenerateInterfaceProperties(cmTarget const* target, std::ostream& os, + void GenerateInterfaceProperties(cmGeneratorTarget const* target, + std::ostream& os, const ImportPropertyMap &properties); void PopulateIncludeDirectoriesInterface( cmTargetExport *target, @@ -159,7 +162,7 @@ protected: }; void ResolveTargetsInGeneratorExpressions(std::string &input, - cmTarget* target, + cmGeneratorTarget* target, std::vector &missingTargets, FreeTargetsReplace replace = NoReplaceFreeTargets); @@ -182,20 +185,20 @@ protected: bool AppendMode; // The set of targets included in the export. - std::set ExportedTargets; + std::set ExportedTargets; private: void PopulateInterfaceProperty(const std::string&, const std::string&, - cmTarget *target, + cmGeneratorTarget* target, cmGeneratorExpression::PreprocessContext, ImportPropertyMap &properties, std::vector &missingTargets); - bool AddTargetNamespace(std::string &input, cmTarget* target, + bool AddTargetNamespace(std::string &input, cmGeneratorTarget* target, std::vector &missingTargets); void ResolveTargetsInGeneratorExpression(std::string &input, - cmTarget* target, + cmGeneratorTarget* target, std::vector &missingTargets); virtual void ReplaceInstallPrefix(std::string &input); diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 7ffab0c52..b695904f8 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -48,7 +48,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) tei = this->IEGen->GetExportSet()->GetTargetExports()->begin(); tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) { - expectedTargets += sep + this->Namespace + (*tei)->Target->GetExportName(); + expectedTargets += + sep + this->Namespace + (*tei)->Target->GetExportName(); sep = " "; cmTargetExport * te = *tei; if(this->ExportedTargets.insert(te->Target).second) @@ -131,12 +132,12 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) tei = allTargets.begin(); tei != allTargets.end(); ++tei) { - cmTarget* te = (*tei)->Target; + cmGeneratorTarget* gt = (*tei)->Target; requiresConfigFiles = requiresConfigFiles - || te->GetType() != cmTarget::INTERFACE_LIBRARY; + || gt->GetType() != cmState::INTERFACE_LIBRARY; - this->GenerateImportTargetCode(os, te); + this->GenerateImportTargetCode(os, gt); ImportPropertyMap properties; @@ -147,32 +148,32 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) cmGeneratorExpression::InstallInterface, properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES", - te, + gt, cmGeneratorExpression::InstallInterface, properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", - te, + gt, cmGeneratorExpression::InstallInterface, properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_COMPILE_OPTIONS", - te, + gt, cmGeneratorExpression::InstallInterface, properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_AUTOUIC_OPTIONS", - te, + gt, cmGeneratorExpression::InstallInterface, properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", - te, + gt, cmGeneratorExpression::InstallInterface, properties, missingTargets); const bool newCMP0022Behavior = - te->GetPolicyStatusCMP0022() != cmPolicies::WARN - && te->GetPolicyStatusCMP0022() != cmPolicies::OLD; + gt->GetPolicyStatusCMP0022() != cmPolicies::WARN + && gt->GetPolicyStatusCMP0022() != cmPolicies::OLD; if (newCMP0022Behavior) { - if (this->PopulateInterfaceLinkLibrariesProperty(te, + if (this->PopulateInterfaceLinkLibrariesProperty(gt, cmGeneratorExpression::InstallInterface, properties, missingTargets) && !this->ExportOld) @@ -180,11 +181,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) require2_8_12 = true; } } - if (te->GetType() == cmTarget::INTERFACE_LIBRARY) + if (gt->GetType() == cmState::INTERFACE_LIBRARY) { require3_0_0 = true; } - if(te->GetProperty("INTERFACE_SOURCES")) + if(gt->GetProperty("INTERFACE_SOURCES")) { // We can only generate INTERFACE_SOURCES in CMake 3.3, but CMake 3.1 // can consume them. @@ -192,14 +193,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) } this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", - te, properties); - cmGeneratorTarget *gtgt = te->GetMakefile() - ->GetGlobalGenerator() - ->GetGeneratorTarget(te); + gt, properties); - this->PopulateCompatibleInterfaceProperties(gtgt, properties); + this->PopulateCompatibleInterfaceProperties(gt, properties); - this->GenerateInterfaceProperties(te, os, properties); + this->GenerateInterfaceProperties(gt, os, properties); } if (require3_1_0) @@ -337,7 +335,7 @@ cmExportInstallFileGenerator { // Collect import properties for this target. cmTargetExport const* te = *tei; - if (te->Target->GetType() == cmTarget::INTERFACE_LIBRARY) + if (te->Target->GetType() == cmState::INTERFACE_LIBRARY) { continue; } @@ -362,8 +360,7 @@ cmExportInstallFileGenerator if(!properties.empty()) { // Get the rest of the target details. - cmGeneratorTarget *gtgt = te->Target->GetMakefile() - ->GetGlobalGenerator()->GetGeneratorTarget(te->Target); + cmGeneratorTarget *gtgt = te->Target; this->SetImportDetailProperties(config, suffix, gtgt, properties, missingTargets); @@ -378,8 +375,8 @@ cmExportInstallFileGenerator // properties); // Generate code in the export file. - this->GenerateImportPropertyCode(os, config, te->Target, properties); - this->GenerateImportedFileChecksCode(os, te->Target, properties, + this->GenerateImportPropertyCode(os, config, gtgt, properties); + this->GenerateImportedFileChecksCode(os, gtgt, properties, importedLocations); } } @@ -402,7 +399,7 @@ cmExportInstallFileGenerator } // Get the target to be installed. - cmTarget* target = itgen->GetTarget()->Target; + cmGeneratorTarget* target = itgen->GetTarget(); // Construct the installed location of the target. std::string dest = itgen->GetDestination(config); @@ -456,12 +453,13 @@ cmExportInstallFileGenerator //---------------------------------------------------------------------------- void -cmExportInstallFileGenerator::HandleMissingTarget( - std::string& link_libs, std::vector& missingTargets, - cmMakefile* mf, cmTarget* depender, cmTarget* dependee) +cmExportInstallFileGenerator::HandleMissingTarget(std::string& link_libs, + std::vector& missingTargets, + cmGeneratorTarget* depender, cmGeneratorTarget* dependee) { const std::string name = dependee->GetName(); - std::vector namespaces = this->FindNamespaces(mf, name); + cmGlobalGenerator* gg = dependee->GetLocalGenerator()->GetGlobalGenerator(); + std::vector namespaces = this->FindNamespaces(gg, name); int targetOccurrences = (int)namespaces.size(); if (targetOccurrences == 1) { @@ -482,10 +480,9 @@ cmExportInstallFileGenerator::HandleMissingTarget( //---------------------------------------------------------------------------- std::vector cmExportInstallFileGenerator -::FindNamespaces(cmMakefile* mf, const std::string& name) +::FindNamespaces(cmGlobalGenerator* gg, const std::string& name) { std::vector namespaces; - cmGlobalGenerator* gg = mf->GetGlobalGenerator(); const cmExportSetMap& exportSets = gg->GetExportSets(); for(cmExportSetMap::const_iterator expIt = exportSets.begin(); @@ -523,8 +520,8 @@ cmExportInstallFileGenerator //---------------------------------------------------------------------------- void cmExportInstallFileGenerator -::ComplainAboutMissingTarget(cmTarget* depender, - cmTarget* dependee, +::ComplainAboutMissingTarget(cmGeneratorTarget* depender, + cmGeneratorTarget* dependee, int occurrences) { std::ostringstream e; diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index b06fee541..13dae8996 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -57,17 +57,16 @@ protected: std::vector &missingTargets); virtual void HandleMissingTarget(std::string& link_libs, std::vector& missingTargets, - cmMakefile* mf, - cmTarget* depender, - cmTarget* dependee); + cmGeneratorTarget* depender, + cmGeneratorTarget* dependee); virtual void ReplaceInstallPrefix(std::string &input); - void ComplainAboutMissingTarget(cmTarget* depender, - cmTarget* dependee, + void ComplainAboutMissingTarget(cmGeneratorTarget* depender, + cmGeneratorTarget* dependee, int occurrences); - std::vector FindNamespaces(cmMakefile* mf, + std::vector FindNamespaces(cmGlobalGenerator* gg, const std::string& name); diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index fde8fb13f..21d961fbc 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -96,8 +96,8 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const cmTarget const& target = l->second; // Skip non-library targets. - if(target.GetType() < cmTarget::STATIC_LIBRARY - || target.GetType() > cmTarget::MODULE_LIBRARY) + if(target.GetType() < cmState::STATIC_LIBRARY + || target.GetType() > cmState::MODULE_LIBRARY) { continue; } @@ -120,15 +120,15 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const std::string ltValue; switch(li->second) { - case cmTarget::GENERAL: + case GENERAL_LibraryType: valueNew += "general;"; ltValue = "general"; break; - case cmTarget::DEBUG: + case DEBUG_LibraryType: valueNew += "debug;"; ltValue = "debug"; break; - case cmTarget::OPTIMIZED: + case OPTIMIZED_LibraryType: valueNew += "optimized;"; ltValue = "optimized"; break; diff --git a/Source/cmExportSet.cxx b/Source/cmExportSet.cxx index 4148fb50b..0059b6400 100644 --- a/Source/cmExportSet.cxx +++ b/Source/cmExportSet.cxx @@ -13,12 +13,22 @@ #include "cmExportSet.h" #include "cmTargetExport.h" #include "cmAlgorithms.h" +#include "cmLocalGenerator.h" cmExportSet::~cmExportSet() { cmDeleteAll(this->TargetExports); } +void cmExportSet::Compute(cmLocalGenerator* lg) +{ + for (std::vector::iterator it = this->TargetExports.begin(); + it != this->TargetExports.end(); ++it) + { + (*it)->Target = lg->FindGeneratorTargetToUse((*it)->TargetName); + } +} + void cmExportSet::AddTargetExport(cmTargetExport* te) { this->TargetExports.push_back(te); diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h index a57aa1204..d780a228c 100644 --- a/Source/cmExportSet.h +++ b/Source/cmExportSet.h @@ -15,6 +15,7 @@ #include "cmSystemTools.h" class cmTargetExport; class cmInstallExportGenerator; +class cmLocalGenerator; /// A set of targets that were installed with the same EXPORT parameter. class cmExportSet @@ -25,6 +26,8 @@ public: /// Destructor ~cmExportSet(); + void Compute(cmLocalGenerator* lg); + void AddTargetExport(cmTargetExport* tgt); void AddInstallation(cmInstallExportGenerator const* installation); diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index ba66531fd..83127e7ed 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -14,22 +14,25 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" +#include "cmLocalGenerator.h" #include "cmGeneratorExpressionDAGChecker.h" //---------------------------------------------------------------------------- cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator( - cmGlobalGenerator* gg) + cmGlobalGenerator* gg, + const std::vector& targets, + cmMakefile* mf) { - gg->CreateGenerationObjects(cmGlobalGenerator::ImportedOnly); + gg->CreateImportedGenerationObjects(mf, targets, this->Exports); } bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os) { - std::set emitted; - std::set emittedDeps; + std::set emitted; + std::set emittedDeps; while(!this->Exports.empty()) { - cmTarget const* te = this->Exports.back(); + cmGeneratorTarget const* te = this->Exports.back(); this->Exports.pop_back(); if (emitted.insert(te).second) { @@ -54,9 +57,9 @@ bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os) } std::string cmExportTryCompileFileGenerator::FindTargets( - const std::string& propName, - cmTarget const* tgt, - std::set &emitted) + const std::string& propName, + cmGeneratorTarget const* tgt, + std::set &emitted) { const char *prop = tgt->GetProperty(propName); if(!prop) @@ -73,15 +76,19 @@ std::string cmExportTryCompileFileGenerator::FindTargets( cmsys::auto_ptr cge = ge.Parse(prop); cmTarget dummyHead; - dummyHead.SetType(cmTarget::EXECUTABLE, "try_compile_dummy_exe"); - dummyHead.SetMakefile(tgt->GetMakefile()); + dummyHead.SetType(cmState::EXECUTABLE, "try_compile_dummy_exe"); + dummyHead.SetMakefile(tgt->Target->GetMakefile()); - std::string result = cge->Evaluate(tgt->GetMakefile(), this->Config, - false, &dummyHead, tgt, &dagChecker); + cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator()); - const std::set &allTargets = cge->GetAllTargetsSeen(); - for(std::set::const_iterator li = allTargets.begin(); - li != allTargets.end(); ++li) + std::string result = cge->Evaluate(tgt->GetLocalGenerator(), this->Config, + false, &gDummyHead, + tgt, &dagChecker); + + const std::set &allTargets = + cge->GetAllTargetsSeen(); + for(std::set::const_iterator li = + allTargets.begin(); li != allTargets.end(); ++li) { if(emitted.insert(*li).second) { @@ -93,20 +100,23 @@ std::string cmExportTryCompileFileGenerator::FindTargets( //---------------------------------------------------------------------------- void -cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target, - ImportPropertyMap& properties, - std::set &emitted) +cmExportTryCompileFileGenerator::PopulateProperties( + const cmGeneratorTarget* target, + ImportPropertyMap& properties, + std::set &emitted) { - cmPropertyMap props = target->GetProperties(); - for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i) + std::vector props = target->GetPropertyKeys(); + for(std::vector::const_iterator i = props.begin(); + i != props.end(); ++i) { - properties[i->first] = i->second.GetValue(); - if(i->first.find("IMPORTED_LINK_INTERFACE_LIBRARIES") == 0 - || i->first.find("IMPORTED_LINK_DEPENDENT_LIBRARIES") == 0 - || i->first.find("INTERFACE_LINK_LIBRARIES") == 0) + properties[*i] = target->GetProperty(*i); + + if(i->find("IMPORTED_LINK_INTERFACE_LIBRARIES") == 0 + || i->find("IMPORTED_LINK_DEPENDENT_LIBRARIES") == 0 + || i->find("INTERFACE_LINK_LIBRARIES") == 0) { - std::string evalResult = this->FindTargets(i->first, + std::string evalResult = this->FindTargets(*i, target, emitted); std::vector depends; @@ -114,7 +124,8 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target, for(std::vector::const_iterator li = depends.begin(); li != depends.end(); ++li) { - cmTarget *tgt = target->GetMakefile()->FindTargetToUse(*li); + cmGeneratorTarget *tgt = + target->GetLocalGenerator()->FindGeneratorTargetToUse(*li); if(tgt && emitted.insert(tgt).second) { this->Exports.push_back(tgt); diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h index 8838eca82..fc135a455 100644 --- a/Source/cmExportTryCompileFileGenerator.h +++ b/Source/cmExportTryCompileFileGenerator.h @@ -20,11 +20,11 @@ class cmInstallTargetGenerator; class cmExportTryCompileFileGenerator: public cmExportFileGenerator { public: - cmExportTryCompileFileGenerator(cmGlobalGenerator* gg); + cmExportTryCompileFileGenerator(cmGlobalGenerator* gg, + std::vector const& targets, + cmMakefile* mf); /** Set the list of targets to export. */ - void SetExports(const std::vector &exports) - { this->Exports = exports; } void SetConfig(const std::string& config) { this->Config = config; } protected: @@ -37,22 +37,22 @@ protected: std::vector&) {} virtual void HandleMissingTarget(std::string&, std::vector&, - cmMakefile*, - cmTarget*, - cmTarget*) {} + cmGeneratorTarget*, + cmGeneratorTarget*) {} - void PopulateProperties(cmTarget const* target, + void PopulateProperties(cmGeneratorTarget const* target, ImportPropertyMap& properties, - std::set &emitted); + std::set& emitted); std::string InstallNameDir(cmGeneratorTarget* target, const std::string& config); private: - std::string FindTargets(const std::string& prop, cmTarget const* tgt, - std::set &emitted); + std::string FindTargets(const std::string& prop, + const cmGeneratorTarget* tgt, + std::set& emitted); - std::vector Exports; + std::vector Exports; std::string Config; }; diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index dfd51c754..9348ef2b3 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -17,7 +17,6 @@ #include "cmake.h" #include "cmSourceFile.h" #include "cmGeneratedFileStream.h" -#include "cmTarget.h" #include "cmSystemTools.h" #include "cmXMLSafe.h" @@ -76,9 +75,8 @@ void cmExtraCodeBlocksGenerator::Generate() void cmExtraCodeBlocksGenerator::CreateProjectFile( const std::vector& lgs) { - const cmMakefile* mf=lgs[0]->GetMakefile(); - std::string outputDir=mf->GetCurrentBinaryDirectory(); - std::string projectName=mf->GetProjectName(); + std::string outputDir=lgs[0]->GetCurrentBinaryDirectory(); + std::string projectName=lgs[0]->GetProjectName(); std::string filename=outputDir+"/"; filename+=projectName+".cbp"; @@ -273,7 +271,7 @@ void cmExtraCodeBlocksGenerator } const std::string &relative = cmSystemTools::RelativePath( - it->second[0]->GetMakefile()->GetHomeDirectory(), + it->second[0]->GetSourceDirectory(), jt->c_str()); std::vector splitted; cmSystemTools::SplitPath(relative, splitted, false); @@ -297,7 +295,7 @@ void cmExtraCodeBlocksGenerator tree.BuildVirtualFolder(virtualFolders); // And one for std::string unitFiles; - tree.BuildUnit(unitFiles, std::string(mf->GetHomeDirectory()) + "/"); + tree.BuildUnit(unitFiles, std::string(lgs[0]->GetSourceDirectory()) + "/"); // figure out the compiler std::string compiler = this->GetCBCompilerId(mf); @@ -307,7 +305,7 @@ void cmExtraCodeBlocksGenerator "\n" " \n" " \n" - "