diff options
96 files changed, 512 insertions, 283 deletions
diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst index 1bdffa4..92e3001 100644 --- a/Help/command/cmake_minimum_required.rst +++ b/Help/command/cmake_minimum_required.rst @@ -28,3 +28,10 @@ which enables compatibility features for CMake 2.4 and lower. The FATAL_ERROR option is accepted but ignored by CMake 2.6 and higher. It should be specified so CMake versions 2.4 and lower fail with an error instead of just a warning. + +.. note:: + Call the ``cmake_minimum_required()`` command at the beginning of + the top-level ``CMakeLists.txt`` file even before calling the + :command:`project` command. It is important to establish version + and policy settings before invoking other commands whose behavior + they may affect. See also policy :policy:`CMP0000`. diff --git a/Help/command/project.rst b/Help/command/project.rst index c601a01..6c5ace7 100644 --- a/Help/command/project.rst +++ b/Help/command/project.rst @@ -55,3 +55,10 @@ literal, direct call to the :command:`project` command; loading one through the :command:`include` command is not sufficient. If no such call exists CMake will implicitly add one to the top that enables the default languages (``C`` and ``CXX``). + +.. note:: + Call the :command:`cmake_minimum_required` command at the beginning + of the top-level ``CMakeLists.txt`` file even before calling the + ``project()`` command. It is important to establish version and + policy settings before invoking other commands whose behavior they + may affect. See also policy :policy:`CMP0000`. diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index ae5e58e..c8525c2 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -695,8 +695,10 @@ edge of linking ``exe1`` is determined by the same :prop_tgt:`POSITION_INDEPENDENT_CODE` property, the dependency graph above contains a cycle. :manual:`cmake(1)` issues a diagnostic in this case. -Output Files ------------- +.. _`Output Artifacts`: + +Output Artifacts +---------------- The buildsystem targets created by the :command:`add_library` and :command:`add_executable` commands create rules to create binary outputs. @@ -708,6 +710,71 @@ name and location of generated binaries. These expressions do not work for ``OBJECT`` libraries however, as there is no single file generated by such libraries which is relevant to the expressions. +There are three kinds of output artifacts that may be build by targets +as detailed in the following sections. Their classification differs +between DLL platforms and non-DLL platforms. All Windows-based +systems including Cygwin are DLL platforms. + +.. _`Runtime Output Artifacts`: + +Runtime Output Artifacts +^^^^^^^^^^^^^^^^^^^^^^^^ + +A *runtime* output artifact of a buildsystem target may be: + +* The executable file (e.g. ``.exe``) of an executable target + created by the :command:`add_executable` command. + +* On DLL platforms: the executable file (e.g. ``.dll``) of a shared + library target created by the :command:`add_library` command + with the ``SHARED`` option. + +The :prop_tgt:`RUNTIME_OUTPUT_DIRECTORY` and :prop_tgt:`RUNTIME_OUTPUT_NAME` +target properties may be used to control runtime output artifact locations +and names in the build tree. + +.. _`Library Output Artifacts`: + +Library Output Artifacts +^^^^^^^^^^^^^^^^^^^^^^^^ + +A *library* output artifact of a buildsystem target may be: + +* The loadable module file (e.g. ``.dll`` or ``.so``) of a module + library target created by the :command:`add_library` command + with the ``MODULE`` option. + +* On non-DLL platforms: the shared library file (e.g. ``.so`` or ``.dylib``) + of a shared shared library target created by the :command:`add_library` + command with the ``SHARED`` option. + +The :prop_tgt:`LIBRARY_OUTPUT_DIRECTORY` and :prop_tgt:`LIBRARY_OUTPUT_NAME` +target properties may be used to control library output artifact locations +and names in the build tree. + +.. _`Archive Output Artifacts`: + +Archive Output Artifacts +^^^^^^^^^^^^^^^^^^^^^^^^ + +An *archive* output artifact of a buildsystem target may be: + +* The static library file (e.g. ``.lib`` or ``.a``) of a static + library target created by the :command:`add_library` command + with the ``STATIC`` option. + +* On DLL platforms: the import library file (e.g. ``.lib``) of a shared + library target created by the :command:`add_library` command + with the ``SHARED`` option. + +* On DLL platforms: the import library file (e.g. ``.lib``) of an + executable target created by the :command:`add_executable` command + when its :prop_tgt:`ENABLE_EXPORTS` target property is set. + +The :prop_tgt:`ARCHIVE_OUTPUT_DIRECTORY` and :prop_tgt:`ARCHIVE_OUTPUT_NAME` +target properties may be used to control archive output artifact locations +and names in the build tree. + Directory-Scoped Commands ------------------------- diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 865e1ef..cbc8a07 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -213,6 +213,7 @@ Variables that Control the Build /variable/CMAKE_ANDROID_API_MIN /variable/CMAKE_ANDROID_GUI /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY + /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG /variable/CMAKE_AUTOMOC_MOC_OPTIONS /variable/CMAKE_AUTOMOC /variable/CMAKE_AUTORCC @@ -236,6 +237,7 @@ Variables that Control the Build /variable/CMAKE_INSTALL_RPATH_USE_LINK_PATH /variable/CMAKE_LANG_VISIBILITY_PRESET /variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY + /variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY_CONFIG /variable/CMAKE_LIBRARY_PATH_FLAG /variable/CMAKE_LINK_DEF_FILE_FLAG /variable/CMAKE_LINK_DEPENDS_NO_SHARED @@ -256,6 +258,7 @@ Variables that Control the Build /variable/CMAKE_PDB_OUTPUT_DIRECTORY_CONFIG /variable/CMAKE_POSITION_INDEPENDENT_CODE /variable/CMAKE_RUNTIME_OUTPUT_DIRECTORY + /variable/CMAKE_RUNTIME_OUTPUT_DIRECTORY_CONFIG /variable/CMAKE_SHARED_LINKER_FLAGS_CONFIG /variable/CMAKE_SHARED_LINKER_FLAGS /variable/CMAKE_SKIP_BUILD_RPATH diff --git a/Help/policy/CMP0026.rst b/Help/policy/CMP0026.rst index 177b655..4889249 100644 --- a/Help/policy/CMP0026.rst +++ b/Help/policy/CMP0026.rst @@ -1,7 +1,7 @@ CMP0026 ------- -Disallow use of the LOCATION target property. +Disallow use of the LOCATION property for build targets. CMake 2.8.12 and lower allowed reading the LOCATION target property (and configuration-specific variants) to diff --git a/Help/policy/CMP0054.rst b/Help/policy/CMP0054.rst index 39f0c40..3754fda 100644 --- a/Help/policy/CMP0054.rst +++ b/Help/policy/CMP0054.rst @@ -16,29 +16,33 @@ Given the following partial example: :: - set(MONKEY 1) - set(ANIMAL MONKEY) + set(A E) + set(E "") - if("${ANIMAL}" STREQUAL "MONKEY") + if("${A}" STREQUAL "") + message("Result is TRUE before CMake 3.1 or when CMP0054 is OLD") + else() + message("Result is FALSE in CMake 3.1 and above if CMP0054 is NEW") + endif() After explicit expansion of variables this gives: :: - if("MONKEY" STREQUAL "MONKEY") + if("E" STREQUAL "") With the policy set to ``OLD`` implicit expansion reduces this semantically to: :: - if("1" STREQUAL "1") + if("" STREQUAL "") With the policy set to ``NEW`` the quoted arguments will not be further dereferenced: :: - if("MONKEY" STREQUAL "MONKEY") + if("E" STREQUAL "") This policy was introduced in CMake version 3.1. CMake version |release| warns when the policy is not set and uses diff --git a/Help/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY.rst b/Help/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY.rst index df57dba..4221069 100644 --- a/Help/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY.rst +++ b/Help/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY.rst @@ -1,7 +1,9 @@ ARCHIVE_OUTPUT_DIRECTORY ------------------------ -.. |XXX| replace:: ARCHIVE +.. |XXX| replace:: :ref:`ARCHIVE <Archive Output Artifacts>` .. |xxx| replace:: archive .. |CMAKE_XXX_OUTPUT_DIRECTORY| replace:: CMAKE_ARCHIVE_OUTPUT_DIRECTORY .. include:: XXX_OUTPUT_DIRECTORY.txt + +See also the :prop_tgt:`ARCHIVE_OUTPUT_DIRECTORY_<CONFIG>` target property. diff --git a/Help/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG.rst b/Help/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG.rst index 3c0c4fd..29991eb 100644 --- a/Help/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG.rst +++ b/Help/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG.rst @@ -1,11 +1,13 @@ ARCHIVE_OUTPUT_DIRECTORY_<CONFIG> --------------------------------- -Per-configuration output directory for ARCHIVE target files. +Per-configuration output directory for +:ref:`ARCHIVE <Archive Output Artifacts>` target files. -This is a per-configuration version of ARCHIVE_OUTPUT_DIRECTORY, but +This is a per-configuration version of the +:prop_tgt:`ARCHIVE_OUTPUT_DIRECTORY` target property, but multi-configuration generators (VS, Xcode) do NOT append a per-configuration subdirectory to the specified directory. This -property is initialized by the value of the variable -CMAKE_ARCHIVE_OUTPUT_DIRECTORY_<CONFIG> if it is set when a target is -created. +property is initialized by the value of the +:variable:`CMAKE_ARCHIVE_OUTPUT_DIRECTORY_<CONFIG>` variable if +it is set when a target is created. diff --git a/Help/prop_tgt/ARCHIVE_OUTPUT_NAME.rst b/Help/prop_tgt/ARCHIVE_OUTPUT_NAME.rst index a137bb8..6150193 100644 --- a/Help/prop_tgt/ARCHIVE_OUTPUT_NAME.rst +++ b/Help/prop_tgt/ARCHIVE_OUTPUT_NAME.rst @@ -1,6 +1,8 @@ ARCHIVE_OUTPUT_NAME ------------------- -.. |XXX| replace:: ARCHIVE +.. |XXX| replace:: :ref:`ARCHIVE <Archive Output Artifacts>` .. |xxx| replace:: archive .. include:: XXX_OUTPUT_NAME.txt + +See also the :prop_tgt:`ARCHIVE_OUTPUT_NAME_<CONFIG>` target property. diff --git a/Help/prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG.rst b/Help/prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG.rst index 314fa58..4f62eb9 100644 --- a/Help/prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG.rst +++ b/Help/prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG.rst @@ -1,6 +1,8 @@ ARCHIVE_OUTPUT_NAME_<CONFIG> ---------------------------- -Per-configuration output name for ARCHIVE target files. +Per-configuration output name for +:ref:`ARCHIVE <Archive Output Artifacts>` target files. -This is the configuration-specific version of ARCHIVE_OUTPUT_NAME. +This is the configuration-specific version of the +:prop_tgt:`ARCHIVE_OUTPUT_NAME` target property. diff --git a/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY.rst b/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY.rst index e1d3a82..785a57b 100644 --- a/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY.rst +++ b/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY.rst @@ -1,7 +1,9 @@ LIBRARY_OUTPUT_DIRECTORY ------------------------ -.. |XXX| replace:: LIBRARY +.. |XXX| replace:: :ref:`LIBRARY <Library Output Artifacts>` .. |xxx| replace:: library .. |CMAKE_XXX_OUTPUT_DIRECTORY| replace:: CMAKE_LIBRARY_OUTPUT_DIRECTORY .. include:: XXX_OUTPUT_DIRECTORY.txt + +See also the :prop_tgt:`LIBRARY_OUTPUT_DIRECTORY_<CONFIG>` target property. diff --git a/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst b/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst index 2a38373..6fc0142 100644 --- a/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst +++ b/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst @@ -1,11 +1,13 @@ LIBRARY_OUTPUT_DIRECTORY_<CONFIG> --------------------------------- -Per-configuration output directory for LIBRARY target files. +Per-configuration output directory for +:ref:`LIBRARY <Library Output Artifacts>` target files. -This is a per-configuration version of LIBRARY_OUTPUT_DIRECTORY, but +This is a per-configuration version of the +:prop_tgt:`LIBRARY_OUTPUT_DIRECTORY` target property, but multi-configuration generators (VS, Xcode) do NOT append a per-configuration subdirectory to the specified directory. This -property is initialized by the value of the variable -CMAKE_LIBRARY_OUTPUT_DIRECTORY_<CONFIG> if it is set when a target is -created. +property is initialized by the value of the +:variable:`CMAKE_LIBRARY_OUTPUT_DIRECTORY_<CONFIG>` variable if +it is set when a target is created. diff --git a/Help/prop_tgt/LIBRARY_OUTPUT_NAME.rst b/Help/prop_tgt/LIBRARY_OUTPUT_NAME.rst index 9e9d401..6027f7f 100644 --- a/Help/prop_tgt/LIBRARY_OUTPUT_NAME.rst +++ b/Help/prop_tgt/LIBRARY_OUTPUT_NAME.rst @@ -1,6 +1,8 @@ LIBRARY_OUTPUT_NAME ------------------- -.. |XXX| replace:: LIBRARY +.. |XXX| replace:: :ref:`LIBRARY <Library Output Artifacts>` .. |xxx| replace:: library .. include:: XXX_OUTPUT_NAME.txt + +See also the :prop_tgt:`LIBRARY_OUTPUT_NAME_<CONFIG>` target property. diff --git a/Help/prop_tgt/LIBRARY_OUTPUT_NAME_CONFIG.rst b/Help/prop_tgt/LIBRARY_OUTPUT_NAME_CONFIG.rst index 785d1b2..1994c7b 100644 --- a/Help/prop_tgt/LIBRARY_OUTPUT_NAME_CONFIG.rst +++ b/Help/prop_tgt/LIBRARY_OUTPUT_NAME_CONFIG.rst @@ -1,6 +1,8 @@ LIBRARY_OUTPUT_NAME_<CONFIG> ---------------------------- -Per-configuration output name for LIBRARY target files. +Per-configuration output name for +:ref:`LIBRARY <Library Output Artifacts>` target files. -This is the configuration-specific version of LIBRARY_OUTPUT_NAME. +This is the configuration-specific version of the +:prop_tgt:`LIBRARY_OUTPUT_NAME` target property. diff --git a/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY.rst b/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY.rst index af5ef44..12390f5 100644 --- a/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY.rst +++ b/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY.rst @@ -1,7 +1,9 @@ RUNTIME_OUTPUT_DIRECTORY ------------------------ -.. |XXX| replace:: RUNTIME +.. |XXX| replace:: :ref:`RUNTIME <Runtime Output Artifacts>` .. |xxx| replace:: runtime .. |CMAKE_XXX_OUTPUT_DIRECTORY| replace:: CMAKE_RUNTIME_OUTPUT_DIRECTORY .. include:: XXX_OUTPUT_DIRECTORY.txt + +See also the :prop_tgt:`RUNTIME_OUTPUT_DIRECTORY_<CONFIG>` target property. diff --git a/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst b/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst index 10be6cf..c100346 100644 --- a/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst +++ b/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst @@ -1,11 +1,13 @@ RUNTIME_OUTPUT_DIRECTORY_<CONFIG> --------------------------------- -Per-configuration output directory for RUNTIME target files. +Per-configuration output directory for +:ref:`RUNTIME <Runtime Output Artifacts>` target files. -This is a per-configuration version of RUNTIME_OUTPUT_DIRECTORY, but +This is a per-configuration version of the +:prop_tgt:`RUNTIME_OUTPUT_DIRECTORY` target property, but multi-configuration generators (VS, Xcode) do NOT append a per-configuration subdirectory to the specified directory. This -property is initialized by the value of the variable -CMAKE_RUNTIME_OUTPUT_DIRECTORY_<CONFIG> if it is set when a target is -created. +property is initialized by the value of the +:variable:`CMAKE_RUNTIME_OUTPUT_DIRECTORY_<CONFIG>` variable if +it is set when a target is created. diff --git a/Help/prop_tgt/RUNTIME_OUTPUT_NAME.rst b/Help/prop_tgt/RUNTIME_OUTPUT_NAME.rst index dc7dba4..11729c3 100644 --- a/Help/prop_tgt/RUNTIME_OUTPUT_NAME.rst +++ b/Help/prop_tgt/RUNTIME_OUTPUT_NAME.rst @@ -1,6 +1,8 @@ RUNTIME_OUTPUT_NAME ------------------- -.. |XXX| replace:: RUNTIME +.. |XXX| replace:: :ref:`RUNTIME <Runtime Output Artifacts>` .. |xxx| replace:: runtime .. include:: XXX_OUTPUT_NAME.txt + +See also the :prop_tgt:`RUNTIME_OUTPUT_NAME_<CONFIG>` target property. diff --git a/Help/prop_tgt/RUNTIME_OUTPUT_NAME_CONFIG.rst b/Help/prop_tgt/RUNTIME_OUTPUT_NAME_CONFIG.rst index f9029e5..b6a31bf 100644 --- a/Help/prop_tgt/RUNTIME_OUTPUT_NAME_CONFIG.rst +++ b/Help/prop_tgt/RUNTIME_OUTPUT_NAME_CONFIG.rst @@ -1,6 +1,8 @@ RUNTIME_OUTPUT_NAME_<CONFIG> ---------------------------- -Per-configuration output name for RUNTIME target files. +Per-configuration output name for +:ref:`RUNTIME <Runtime Output Artifacts>` target files. -This is the configuration-specific version of RUNTIME_OUTPUT_NAME. +This is the configuration-specific version of the +:prop_tgt:`RUNTIME_OUTPUT_NAME` target property. diff --git a/Help/prop_tgt/TARGET_FILE_TYPES.txt b/Help/prop_tgt/TARGET_FILE_TYPES.txt deleted file mode 100644 index 18489c7..0000000 --- a/Help/prop_tgt/TARGET_FILE_TYPES.txt +++ /dev/null @@ -1,9 +0,0 @@ -There are three kinds of target files that may be built: archive, -library, and runtime. Executables are always treated as runtime -targets. Static libraries are always treated as archive targets. -Module libraries are always treated as library targets. For -non-DLL platforms shared libraries are treated as library -targets. For DLL platforms the DLL part of a shared library is -treated as a runtime target and the corresponding import library -is treated as an archive target. All Windows-based systems -including Cygwin are DLL platforms. diff --git a/Help/prop_tgt/XXX_OUTPUT_DIRECTORY.txt b/Help/prop_tgt/XXX_OUTPUT_DIRECTORY.txt index 65abbce..0b3d31c 100644 --- a/Help/prop_tgt/XXX_OUTPUT_DIRECTORY.txt +++ b/Help/prop_tgt/XXX_OUTPUT_DIRECTORY.txt @@ -4,7 +4,5 @@ This property specifies the directory into which |xxx| target files should be built. Multi-configuration generators (VS, Xcode) append a per-configuration subdirectory to the specified directory. -.. include:: TARGET_FILE_TYPES.txt - This property is initialized by the value of the variable |CMAKE_XXX_OUTPUT_DIRECTORY| if it is set when a target is created. diff --git a/Help/prop_tgt/XXX_OUTPUT_NAME.txt b/Help/prop_tgt/XXX_OUTPUT_NAME.txt index 9c4fc7c..126f391 100644 --- a/Help/prop_tgt/XXX_OUTPUT_NAME.txt +++ b/Help/prop_tgt/XXX_OUTPUT_NAME.txt @@ -1,6 +1,5 @@ Output name for |XXX| target files. This property specifies the base name for |xxx| target files. It -overrides OUTPUT_NAME and OUTPUT_NAME_<CONFIG> properties. - -.. include:: TARGET_FILE_TYPES.txt +overrides :prop_tgt:`OUTPUT_NAME` and :prop_tgt:`OUTPUT_NAME_<CONFIG>` +properties. diff --git a/Help/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY.rst b/Help/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY.rst index 6a22f73..c889321 100644 --- a/Help/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY.rst +++ b/Help/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY.rst @@ -1,8 +1,9 @@ CMAKE_ARCHIVE_OUTPUT_DIRECTORY ------------------------------ -Where to put all the ARCHIVE targets when built. +Where to put all the :ref:`ARCHIVE <Archive Output Artifacts>` +target files when built. -This variable is used to initialize the ARCHIVE_OUTPUT_DIRECTORY +This variable is used to initialize the :prop_tgt:`ARCHIVE_OUTPUT_DIRECTORY` property on all the targets. See that target property for additional information. diff --git a/Help/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG.rst b/Help/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG.rst new file mode 100644 index 0000000..94c2b6e --- /dev/null +++ b/Help/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG.rst @@ -0,0 +1,9 @@ +CMAKE_ARCHIVE_OUTPUT_DIRECTORY_<CONFIG> +--------------------------------------- + +Where to put all the :ref:`ARCHIVE <Archive Output Artifacts>` +target files when built for a specific configuration. + +This variable is used to initialize the +:prop_tgt:`ARCHIVE_OUTPUT_DIRECTORY_<CONFIG>` property on all the targets. +See that target property for additional information. diff --git a/Help/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY.rst b/Help/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY.rst index 3bdd348..e97296d 100644 --- a/Help/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY.rst +++ b/Help/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY.rst @@ -1,8 +1,9 @@ CMAKE_LIBRARY_OUTPUT_DIRECTORY ------------------------------ -Where to put all the LIBRARY targets when built. +Where to put all the :ref:`LIBRARY <Library Output Artifacts>` +target files when built. -This variable is used to initialize the LIBRARY_OUTPUT_DIRECTORY +This variable is used to initialize the :prop_tgt:`LIBRARY_OUTPUT_DIRECTORY` property on all the targets. See that target property for additional information. diff --git a/Help/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst b/Help/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst new file mode 100644 index 0000000..e069cdd --- /dev/null +++ b/Help/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst @@ -0,0 +1,9 @@ +CMAKE_LIBRARY_OUTPUT_DIRECTORY_<CONFIG> +--------------------------------------- + +Where to put all the :ref:`LIBRARY <Library Output Artifacts>` +target files when built for a specific configuration. + +This variable is used to initialize the +:prop_tgt:`LIBRARY_OUTPUT_DIRECTORY_<CONFIG>` property on all the targets. +See that target property for additional information. diff --git a/Help/variable/CMAKE_RUNTIME_OUTPUT_DIRECTORY.rst b/Help/variable/CMAKE_RUNTIME_OUTPUT_DIRECTORY.rst index 366ca66..6253d4a 100644 --- a/Help/variable/CMAKE_RUNTIME_OUTPUT_DIRECTORY.rst +++ b/Help/variable/CMAKE_RUNTIME_OUTPUT_DIRECTORY.rst @@ -1,8 +1,9 @@ CMAKE_RUNTIME_OUTPUT_DIRECTORY ------------------------------ -Where to put all the RUNTIME targets when built. +Where to put all the :ref:`RUNTIME <Runtime Output Artifacts>` +target files when built. -This variable is used to initialize the RUNTIME_OUTPUT_DIRECTORY +This variable is used to initialize the :prop_tgt:`RUNTIME_OUTPUT_DIRECTORY` property on all the targets. See that target property for additional information. diff --git a/Help/variable/CMAKE_RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst b/Help/variable/CMAKE_RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst new file mode 100644 index 0000000..080dea6 --- /dev/null +++ b/Help/variable/CMAKE_RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst @@ -0,0 +1,9 @@ +CMAKE_RUNTIME_OUTPUT_DIRECTORY_<CONFIG> +--------------------------------------- + +Where to put all the :ref:`RUNTIME <Runtime Output Artifacts>` +target files when built for a specific configuration. + +This variable is used to initialize the +:prop_tgt:`RUNTIME_OUTPUT_DIRECTORY_<CONFIG>` property on all the targets. +See that target property for additional information. diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 532596d..e223286 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -228,7 +228,7 @@ # # List of four values that specify what project to install. The four values # are: Build directory, Project Name, Project Component, Directory. If -# omitted, CPack will build an installer that installers everything. +# omitted, CPack will build an installer that installs everything. # # .. variable:: CPACK_SYSTEM_NAME # diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f76ba0d..592d922 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 2) -set(CMake_VERSION_PATCH 20150429) +set(CMake_VERSION_PATCH 20150430) #set(CMake_VERSION_RC 1) diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index fe32dd5..abb46b3 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -21,13 +21,6 @@ cmDefinitions::cmDefinitions(cmDefinitions* parent) } //---------------------------------------------------------------------------- -void cmDefinitions::Reset(cmDefinitions* parent) -{ - this->Up = parent; - this->Map.clear(); -} - -//---------------------------------------------------------------------------- cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key) { @@ -46,37 +39,29 @@ cmDefinitions::GetInternal(const std::string& key) } //---------------------------------------------------------------------------- -cmDefinitions::Def const& -cmDefinitions::SetInternal(const std::string& key, Def const& def) +const char* cmDefinitions::Get(const std::string& key) +{ + Def const& def = this->GetInternal(key); + return def.Exists? def.c_str() : 0; +} + +//---------------------------------------------------------------------------- +void cmDefinitions::Set(const std::string& key, const char* value) { + Def def(value); if(this->Up || def.Exists) { // In lower scopes we store keys, defined or not. - return (this->Map[key] = def); + this->Map[key] = def; } else { // In the top-most scope we need not store undefined keys. this->Map.erase(key); - return this->NoDef; } } //---------------------------------------------------------------------------- -const char* cmDefinitions::Get(const std::string& key) -{ - Def const& def = this->GetInternal(key); - return def.Exists? def.c_str() : 0; -} - -//---------------------------------------------------------------------------- -const char* cmDefinitions::Set(const std::string& key, const char* value) -{ - Def const& def = this->SetInternal(key, Def(value)); - return def.Exists? def.c_str() : 0; -} - -//---------------------------------------------------------------------------- std::set<std::string> cmDefinitions::LocalKeys() const { std::set<std::string> keys; diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index a2f053f..83cd0d9 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -30,9 +30,6 @@ public: /** Construct with the given parent scope. */ cmDefinitions(cmDefinitions* parent = 0); - /** Reset object as if newly constructed. */ - void Reset(cmDefinitions* parent = 0); - /** Returns the parent scope, if any. */ cmDefinitions* GetParent() const { return this->Up; } @@ -41,7 +38,7 @@ public: const char* Get(const std::string& key); /** Set (or unset if null) a value associated with a key. */ - const char* Set(const std::string& key, const char* value); + void Set(const std::string& key, const char* value); /** Get the set of all local keys. */ std::set<std::string> LocalKeys() const; @@ -81,7 +78,6 @@ private: // Internal query and update methods. Def const& GetInternal(const std::string& key); - Def const& SetInternal(const std::string& key, Def const& def); // Implementation of Closure() method. struct ClosureTag {}; diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index e557619..597e08e 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -37,9 +37,11 @@ void cmGlobalBorlandMakefileGenerator } ///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator() +cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator( + cmLocalGenerator* parent) { - cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3; + cmLocalUnixMakefileGenerator3* lg = + new cmLocalUnixMakefileGenerator3(parent); lg->SetIncludeDirective("!include"); lg->SetWindowsShell(true); lg->SetDefineWindowsNULL(true); diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index 005f0d6..3f79414 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -36,7 +36,7 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 774b172..384f023 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1878,9 +1878,10 @@ void cmGlobalGenerator::EnableInstallTarget() this->InstallTargetEnabled = true; } -cmLocalGenerator *cmGlobalGenerator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator *parent) { - cmLocalGenerator *lg = new cmLocalGenerator; + cmLocalGenerator *lg = new cmLocalGenerator(parent); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index ce3f037..b51bd47 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -53,7 +53,7 @@ public: virtual ~cmGlobalGenerator(); ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); ///! Get the name for this generator virtual std::string GetName() const { return "Generic"; } diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index bba29b1..181a517 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -32,9 +32,10 @@ cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() cmDeleteAll(TargetFolderBuildStreams); } -cmLocalGenerator *cmGlobalGhsMultiGenerator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalGenerator *lg = new cmLocalGhsMultiGenerator; + cmLocalGenerator *lg = new cmLocalGhsMultiGenerator(parent); lg->SetGlobalGenerator(this); this->SetCurrentLocalGenerator(lg); return lg; diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index b934c3a..6464f5c 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -31,7 +31,7 @@ public: { return new cmGlobalGeneratorSimpleFactory<cmGlobalGhsMultiGenerator>(); } ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); /// @return the name of this generator. static std::string GetActualName() { return "Green Hills MULTI"; } diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index bc15ef2..cfa5072 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -45,9 +45,11 @@ void cmGlobalJOMMakefileGenerator } ///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalJOMMakefileGenerator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalJOMMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3; + cmLocalUnixMakefileGenerator3* lg + = new cmLocalUnixMakefileGenerator3(parent); lg->SetDefineWindowsNULL(true); lg->SetWindowsShell(true); lg->SetMakeSilentFlag("/nologo"); diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h index fbb35f3..4831309 100644 --- a/Source/cmGlobalJOMMakefileGenerator.h +++ b/Source/cmGlobalJOMMakefileGenerator.h @@ -37,7 +37,7 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index 16f05e5..fa23491 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -93,9 +93,11 @@ void cmGlobalMSYSMakefileGenerator } ///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalMSYSMakefileGenerator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalMSYSMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3; + cmLocalUnixMakefileGenerator3* lg = + new cmLocalUnixMakefileGenerator3(parent); lg->SetWindowsShell(false); lg->SetMSYSShell(true); lg->SetGlobalGenerator(this); diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h index baecde7..1795d86 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.h +++ b/Source/cmGlobalMSYSMakefileGenerator.h @@ -36,7 +36,7 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index e00c7dd..c9389aa 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -31,9 +31,11 @@ void cmGlobalMinGWMakefileGenerator } ///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalMinGWMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3; + cmLocalUnixMakefileGenerator3* lg = + new cmLocalUnixMakefileGenerator3(parent); lg->SetWindowsShell(true); lg->SetGlobalGenerator(this); lg->SetIgnoreLibPrefix(true); diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h index fa8d9f2..93f67be 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.h +++ b/Source/cmGlobalMinGWMakefileGenerator.h @@ -35,7 +35,7 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 4fbabe4..a3b3dd7 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -45,9 +45,11 @@ void cmGlobalNMakeMakefileGenerator } ///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalNMakeMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3; + cmLocalUnixMakefileGenerator3* lg = + new cmLocalUnixMakefileGenerator3(parent); lg->SetDefineWindowsNULL(true); lg->SetWindowsShell(true); lg->SetMakeSilentFlag("/nologo"); diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index e7b03dd..cb898ba 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -35,7 +35,7 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 76f2e14..074c4d1 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -496,9 +496,10 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator() //---------------------------------------------------------------------------- // Virtual public methods. -cmLocalGenerator* cmGlobalNinjaGenerator::CreateLocalGenerator() +cmLocalGenerator* +cmGlobalNinjaGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalGenerator* lg = new cmLocalNinjaGenerator; + cmLocalGenerator* lg = new cmLocalNinjaGenerator(parent); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 6aa76f9..d7b3add 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -171,7 +171,7 @@ public: virtual ~cmGlobalNinjaGenerator() { } /// Overloaded methods. @see cmGlobalGenerator::CreateLocalGenerator() - virtual cmLocalGenerator* CreateLocalGenerator(); + virtual cmLocalGenerator* CreateLocalGenerator(cmLocalGenerator* parent = 0); /// Overloaded methods. @see cmGlobalGenerator::GetName(). virtual std::string GetName() const { diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 8cf6be1..95998ae 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -53,9 +53,10 @@ void cmGlobalUnixMakefileGenerator3 } ///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalUnixMakefileGenerator3::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalGenerator* lg = new cmLocalUnixMakefileGenerator3; + cmLocalGenerator* lg = new cmLocalUnixMakefileGenerator3(parent); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index a76a835..165a3c8 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -68,7 +68,7 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator3 - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 8240099..6481ec2 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -308,10 +308,12 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout) } ///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalVisualStudio10Generator* lg = - new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS10); + new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS10, + parent); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index f0dd7d7..8cb2588 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -46,7 +46,7 @@ public: ); ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 5d3ae16..45d6d95 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -237,10 +237,12 @@ void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout) } //---------------------------------------------------------------------------- -cmLocalGenerator *cmGlobalVisualStudio11Generator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalVisualStudio11Generator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalVisualStudio10Generator* lg = - new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11); + new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11, + parent); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 6d434eb..ae4b888 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -29,7 +29,7 @@ public: virtual void WriteSLNHeader(std::ostream& fout); ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); protected: virtual bool InitializeWindowsPhone(cmMakefile* mf); diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index e70e082..e298b06 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -217,10 +217,12 @@ void cmGlobalVisualStudio12Generator::WriteSLNHeader(std::ostream& fout) } //---------------------------------------------------------------------------- -cmLocalGenerator *cmGlobalVisualStudio12Generator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalVisualStudio12Generator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalVisualStudio10Generator* lg = - new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS12); + new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS12, + parent); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index 5e5b5f7..d304bc1 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -29,7 +29,7 @@ public: virtual void WriteSLNHeader(std::ostream& fout); ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); //in Visual Studio 2013 they detached the MSBuild tools version //from the .Net Framework version and instead made it have it's own diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 7b1dd24..6642d88 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -128,10 +128,12 @@ void cmGlobalVisualStudio14Generator::WriteSLNHeader(std::ostream& fout) } //---------------------------------------------------------------------------- -cmLocalGenerator *cmGlobalVisualStudio14Generator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalVisualStudio14Generator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalVisualStudio10Generator* lg = - new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS14); + new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS14, + parent); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index ad1a460..59f1e60 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -29,7 +29,7 @@ public: virtual void WriteSLNHeader(std::ostream& fout); ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); virtual const char* GetToolsVersion() { return "14.0"; } protected: diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 0852db6..55e70b3 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -170,9 +170,10 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand( } ///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalVisualStudio6Generator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalGenerator *lg = new cmLocalVisualStudio6Generator; + cmLocalGenerator *lg = new cmLocalVisualStudio6Generator(parent); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index a59a0b2..d748a85 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -39,7 +39,7 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index a67a649..db34d44 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -25,10 +25,12 @@ cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator( //---------------------------------------------------------------------------- ///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalVisualStudio71Generator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalVisualStudio71Generator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalVisualStudio7Generator *lg = - new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS71); + new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS71, + parent); lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); lg->SetGlobalGenerator(this); return lg; diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 2b5259a..ad6c153 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -37,7 +37,7 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); /** * Where does this version of Visual Studio look for macros for the diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 1b03193..de90f7e 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -250,10 +250,12 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( } ///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalVisualStudio7Generator *lg = - new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS7); + new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS7, + parent); lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); lg->SetGlobalGenerator(this); return lg; diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index d641c02..92c5f1a 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -42,7 +42,7 @@ public: std::string const& GetPlatformName() const; ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); virtual bool SetSystemName(std::string const& s, cmMakefile* mf); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index bb50633..7174f21 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -125,10 +125,12 @@ std::string cmGlobalVisualStudio8Generator::FindDevEnvCommand() //---------------------------------------------------------------------------- ///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalVisualStudio8Generator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalVisualStudio7Generator *lg = - new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8); + new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8, + parent); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetGlobalGenerator(this); return lg; diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 4b41ed7..ee5ba9f 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -34,7 +34,7 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *, bool optional); diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 1bc627f..0303c27 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -114,10 +114,12 @@ void cmGlobalVisualStudio9Generator::WriteSLNHeader(std::ostream& fout) } ///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalVisualStudio9Generator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalVisualStudio7Generator *lg - = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9); + = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9, + parent); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetGlobalGenerator(this); return lg; diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index 0a191cd..97b7804 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -29,7 +29,7 @@ public: static cmGlobalGeneratorFactory* NewFactory(); ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index e44ed79..77c6474 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -41,9 +41,11 @@ void cmGlobalWatcomWMakeGenerator } ///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalWatcomWMakeGenerator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalWatcomWMakeGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3; + cmLocalUnixMakefileGenerator3* lg + = new cmLocalUnixMakefileGenerator3(parent); lg->SetDefineWindowsNULL(true); #ifdef _WIN32 lg->SetWindowsShell(true); diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index 7bc209b..3af2f9d 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -35,7 +35,7 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index d333c1d..742750c 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -368,9 +368,10 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( //---------------------------------------------------------------------------- ///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalXCodeGenerator::CreateLocalGenerator() +cmLocalGenerator * +cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalGenerator *lg = new cmLocalXCodeGenerator; + cmLocalGenerator *lg = new cmLocalXCodeGenerator(parent); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 1a69fce..6c911a4 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -41,7 +41,7 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(); + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); /** * Try to determine system information such as shared library diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index dc74374..6b705e8 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -43,10 +43,14 @@ #include <StorageDefs.h> #endif -cmLocalGenerator::cmLocalGenerator() +cmLocalGenerator::cmLocalGenerator(cmLocalGenerator* parent) { this->Makefile = 0; // moved to after set on global - this->Parent = 0; + this->Parent = parent; + if (parent) + { + parent->AddChild(this); + } this->WindowsShell = false; this->WindowsVSIDE = false; this->WatcomWMake = false; @@ -249,8 +253,7 @@ void cmLocalGenerator::SetupPathConversions() void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg) { this->GlobalGenerator = gg; - this->Makefile = new cmMakefile; - this->Makefile->SetLocalGenerator(this); + this->Makefile = new cmMakefile(this); } void cmLocalGenerator::ConfigureFinalPass() diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index a005f5f..befddbf 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -33,7 +33,7 @@ class cmCustomCommandGenerator; class cmLocalGenerator { public: - cmLocalGenerator(); + cmLocalGenerator(cmLocalGenerator* parent); virtual ~cmLocalGenerator(); /** @@ -131,7 +131,6 @@ public: ///! set/get the parent generator cmLocalGenerator* GetParent() const {return this->Parent;} - void SetParent(cmLocalGenerator* g) { this->Parent = g; g->AddChild(this); } ///! set/get the children void AddChild(cmLocalGenerator* g) { this->Children.push_back(g); } diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index a3edc45..fa2a1a5 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -16,7 +16,8 @@ #include "cmGhsMultiTargetGenerator.h" #include "cmGeneratedFileStream.h" -cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator() +cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmLocalGenerator* parent) + : cmLocalGenerator(parent) { } diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h index a8df3e7..7afef56 100644 --- a/Source/cmLocalGhsMultiGenerator.h +++ b/Source/cmLocalGhsMultiGenerator.h @@ -25,7 +25,7 @@ class cmGeneratedFileStream; class cmLocalGhsMultiGenerator : public cmLocalGenerator { public: - cmLocalGhsMultiGenerator(); + cmLocalGhsMultiGenerator(cmLocalGenerator* parent); virtual ~cmLocalGhsMultiGenerator(); diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index d4741a0..4e817a0 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -22,8 +22,8 @@ #include <assert.h> -cmLocalNinjaGenerator::cmLocalNinjaGenerator() - : cmLocalGenerator() +cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmLocalGenerator* parent) + : cmLocalGenerator(parent) , ConfigName("") , HomeRelativeOutputPath("") { diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 01e16df..d72677b 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -32,7 +32,7 @@ class cmLocalNinjaGenerator : public cmLocalGenerator { public: /// Default constructor. - cmLocalNinjaGenerator(); + cmLocalNinjaGenerator(cmLocalGenerator* parent); /// Destructor. virtual ~cmLocalNinjaGenerator(); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f66b54a..bf6fb61 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -79,7 +79,9 @@ static std::string cmSplitExtension(std::string const& in, std::string& base) } //---------------------------------------------------------------------------- -cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3() +cmLocalUnixMakefileGenerator3:: +cmLocalUnixMakefileGenerator3(cmLocalGenerator* parent) + : cmLocalGenerator(parent) { this->WindowsShell = false; this->IncludeDirective = "include"; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index a2f4245..9f83b86 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -34,7 +34,7 @@ class cmSourceFile; class cmLocalUnixMakefileGenerator3 : public cmLocalGenerator { public: - cmLocalUnixMakefileGenerator3(); + cmLocalUnixMakefileGenerator3(cmLocalGenerator* parent); virtual ~cmLocalUnixMakefileGenerator3(); /** diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 2b67562..73a4ec8 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -61,8 +61,9 @@ class cmVS10XMLParser : public cmXMLParser //---------------------------------------------------------------------------- -cmLocalVisualStudio10Generator::cmLocalVisualStudio10Generator(VSVersion v): - cmLocalVisualStudio7Generator(v) +cmLocalVisualStudio10Generator +::cmLocalVisualStudio10Generator(VSVersion v, cmLocalGenerator* parent): + cmLocalVisualStudio7Generator(v, parent) { } diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h index b50e345..f90daa0 100644 --- a/Source/cmLocalVisualStudio10Generator.h +++ b/Source/cmLocalVisualStudio10Generator.h @@ -25,7 +25,7 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator { public: ///! Set cache only and recurse to false by default. - cmLocalVisualStudio10Generator(VSVersion v); + cmLocalVisualStudio10Generator(VSVersion v, cmLocalGenerator* parent); virtual ~cmLocalVisualStudio10Generator(); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 69da9fb..6d89b15 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -23,8 +23,9 @@ #include <cmsys/RegularExpression.hxx> #include <cmsys/FStream.hxx> -cmLocalVisualStudio6Generator::cmLocalVisualStudio6Generator(): - cmLocalVisualStudioGenerator(VS6) +cmLocalVisualStudio6Generator +::cmLocalVisualStudio6Generator(cmLocalGenerator* parent): + cmLocalVisualStudioGenerator(VS6, parent) { } diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index 4771833..1a0a614 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -29,7 +29,7 @@ class cmLocalVisualStudio6Generator : public cmLocalVisualStudioGenerator { public: ///! Set cache only and recurse to false by default. - cmLocalVisualStudio6Generator(); + cmLocalVisualStudio6Generator(cmLocalGenerator* parent); virtual ~cmLocalVisualStudio6Generator(); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 928481c..2152f77 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -54,8 +54,9 @@ static void cmConvertToWindowsSlash(std::string& s) } //---------------------------------------------------------------------------- -cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator(VSVersion v): - cmLocalVisualStudioGenerator(v) +cmLocalVisualStudio7Generator +::cmLocalVisualStudio7Generator(VSVersion v, cmLocalGenerator* parent): + cmLocalVisualStudioGenerator(v, parent) { this->ExtraFlagTable = 0; this->Internal = new cmLocalVisualStudio7GeneratorInternals(this); diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index c2caa26..cfbc63c 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -35,7 +35,7 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator { public: ///! Set cache only and recurse to false by default. - cmLocalVisualStudio7Generator(VSVersion v); + cmLocalVisualStudio7Generator(VSVersion v, cmLocalGenerator* parent); virtual ~cmLocalVisualStudio7Generator(); diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index f01aa6b..854ad34 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -18,7 +18,9 @@ #include "windows.h" //---------------------------------------------------------------------------- -cmLocalVisualStudioGenerator::cmLocalVisualStudioGenerator(VSVersion v) +cmLocalVisualStudioGenerator +::cmLocalVisualStudioGenerator(VSVersion v, cmLocalGenerator* parent) + : cmLocalGenerator(parent) { this->WindowsShell = true; this->WindowsVSIDE = true; diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index d26c2ea..562d595 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -45,7 +45,7 @@ public: VS14 = 140 }; - cmLocalVisualStudioGenerator(VSVersion v); + cmLocalVisualStudioGenerator(VSVersion v, cmLocalGenerator* parent); virtual ~cmLocalVisualStudioGenerator(); /** Construct a script from the given list of command lines. */ diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index 8ff6c87..1d3a8cf 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -15,7 +15,8 @@ #include "cmMakefile.h" //---------------------------------------------------------------------------- -cmLocalXCodeGenerator::cmLocalXCodeGenerator() +cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmLocalGenerator* parent) + : cmLocalGenerator(parent) { // the global generator does this, so do not // put these flags into the language flags diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index f553a17..1a5760f 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -24,7 +24,7 @@ class cmLocalXCodeGenerator : public cmLocalGenerator { public: ///! Set cache only and recurse to false by default. - cmLocalXCodeGenerator(); + cmLocalXCodeGenerator(cmLocalGenerator* parent); virtual ~cmLocalXCodeGenerator(); virtual std::string GetTargetDirectory(cmTarget const& target) const; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0f0cb34..9f1d107 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -53,7 +53,11 @@ public: }; // default is not to be building executables -cmMakefile::cmMakefile(): Internal(new Internals) +cmMakefile::cmMakefile(cmLocalGenerator* localGenerator) + : Internal(new Internals), + LocalGenerator(localGenerator), + StateSnapshot(localGenerator->GetGlobalGenerator() + ->GetCMakeInstance()->GetState()) { const cmDefinitions& defs = cmDefinitions(); const std::set<std::string> globalKeys = defs.LocalKeys(); @@ -62,6 +66,19 @@ cmMakefile::cmMakefile(): Internal(new Internals) this->Internal->VarUsageStack.push(globalKeys); this->Internal->IsSourceFileTryCompile = false; + if (this->LocalGenerator->GetParent()) + { + cmMakefile* parentMf = this->LocalGenerator->GetParent()->GetMakefile(); + this->StateSnapshot = + this->GetState()->CreateSnapshot(parentMf->StateSnapshot); + } + else + { + this->StateSnapshot = + this->GetState()->CreateSnapshot(this->StateSnapshot); + } + + // Initialize these first since AddDefaultDefinitions calls AddDefinition this->WarnUnused = false; this->CheckSystemVars = false; @@ -97,7 +114,7 @@ cmMakefile::cmMakefile(): Internal(new Internals) this->HeaderFileExtensions.push_back( "txx" ); this->DefineFlags = " "; - this->LocalGenerator = 0; + this->LocalGenerator = localGenerator; this->AddDefaultDefinitions(); this->Initialize(); @@ -126,6 +143,39 @@ void cmMakefile::Initialize() // By default the check is not done. It is enabled by // cmListFileCache in the top level if necessary. this->CheckCMP0000 = false; + +#if defined(CMAKE_BUILD_WITH_CMAKE) + this->AddSourceGroup("", "^.*$"); + this->AddSourceGroup + ("Source Files", + "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|f90|for|fpp" + "|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$"); + this->AddSourceGroup("Header Files", CM_HEADER_REGEX); + this->AddSourceGroup("CMake Rules", "\\.rule$"); + this->AddSourceGroup("Resources", "\\.plist$"); + this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$"); +#endif + + this->Properties.SetCMakeInstance(this->GetCMakeInstance()); + this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused(); + this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars(); + + { + const char* dir = this->GetCMakeInstance()->GetHomeDirectory(); + this->AddDefinition("CMAKE_SOURCE_DIR", dir); + if ( !this->GetDefinition("CMAKE_CURRENT_SOURCE_DIR") ) + { + this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", dir); + } + } + { + const char* dir = this->GetCMakeInstance()->GetHomeOutputDirectory(); + this->AddDefinition("CMAKE_BINARY_DIR", dir); + if ( !this->GetDefinition("CMAKE_CURRENT_BINARY_DIR") ) + { + this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", dir); + } + } } cmMakefile::~cmMakefile() @@ -181,11 +231,11 @@ void cmMakefile::Print() const std::cout << " this->StartOutputDirectory; " << this->GetCurrentBinaryDirectory() << std::endl; std::cout << " this->HomeOutputDirectory; " << - this->HomeOutputDirectory << std::endl; + this->GetHomeOutputDirectory() << std::endl; std::cout << " this->cmStartDirectory; " << this->GetCurrentSourceDirectory() << std::endl; std::cout << " this->cmHomeDirectory; " << - this->cmHomeDirectory << std::endl; + this->GetHomeDirectory() << std::endl; std::cout << " this->ProjectName; " << this->ProjectName << std::endl; this->PrintStringVector("this->LinkDirectories", this->LinkDirectories); @@ -630,32 +680,6 @@ void cmMakefile::EnforceDirectoryLevelRules() const } } -// Set the make file -void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg) -{ - this->LocalGenerator = lg; - // the source groups need to access the global generator - // so don't create them until the lg is set -#if defined(CMAKE_BUILD_WITH_CMAKE) - this->AddSourceGroup("", "^.*$"); - this->AddSourceGroup - ("Source Files", - "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|f90|for|fpp" - "|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$"); - this->AddSourceGroup("Header Files", CM_HEADER_REGEX); - this->AddSourceGroup("CMake Rules", "\\.rule$"); - this->AddSourceGroup("Resources", "\\.plist$"); - this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$"); -#endif - - this->Properties.SetCMakeInstance(this->GetCMakeInstance()); - this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused(); - this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars(); - this->SetHomeDirectory(this->GetCMakeInstance()->GetHomeDirectory()); - this->SetHomeOutputDirectory( - this->GetCMakeInstance()->GetHomeOutputDirectory()); -} - namespace { struct file_not_persistent @@ -1576,8 +1600,8 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, // create a new local generator and set its parent cmLocalGenerator *lg2 = - this->LocalGenerator->GetGlobalGenerator()->CreateLocalGenerator(); - lg2->SetParent(this->LocalGenerator); + this->LocalGenerator->GetGlobalGenerator() + ->CreateLocalGenerator(this->LocalGenerator); this->LocalGenerator->GetGlobalGenerator()->AddLocalGenerator(lg2); // set the subdirs start dirs @@ -1596,33 +1620,27 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, void cmMakefile::SetCurrentSourceDirectory(const std::string& dir) { - this->cmStartDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); - this->cmStartDirectory = - cmSystemTools::CollapseFullPath(this->cmStartDirectory); + this->StateSnapshot.SetCurrentSourceDirectory(dir); this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", - this->cmStartDirectory.c_str()); + this->StateSnapshot.GetCurrentSourceDirectory()); } const char* cmMakefile::GetCurrentSourceDirectory() const { - return this->cmStartDirectory.c_str(); + return this->StateSnapshot.GetCurrentSourceDirectory(); } void cmMakefile::SetCurrentBinaryDirectory(const std::string& dir) { - this->StartOutputDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); - this->StartOutputDirectory = - cmSystemTools::CollapseFullPath(this->StartOutputDirectory); - cmSystemTools::MakeDirectory(this->StartOutputDirectory.c_str()); - this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", - this->StartOutputDirectory.c_str()); + this->StateSnapshot.SetCurrentBinaryDirectory(dir); + const char* binDir = this->StateSnapshot.GetCurrentBinaryDirectory(); + cmSystemTools::MakeDirectory(binDir); + this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", binDir); } const char* cmMakefile::GetCurrentBinaryDirectory() const { - return this->StartOutputDirectory.c_str(); + return this->StateSnapshot.GetCurrentBinaryDirectory(); } //---------------------------------------------------------------------------- @@ -3355,35 +3373,12 @@ cmMakefile::LexicalPushPop::~LexicalPushPop() const char* cmMakefile::GetHomeDirectory() const { - return this->cmHomeDirectory.c_str(); -} - -void cmMakefile::SetHomeDirectory(const std::string& dir) -{ - this->cmHomeDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory); - this->AddDefinition("CMAKE_SOURCE_DIR", this->GetHomeDirectory()); - if ( !this->GetDefinition("CMAKE_CURRENT_SOURCE_DIR") ) - { - this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", this->GetHomeDirectory()); - } + return this->GetCMakeInstance()->GetHomeDirectory(); } const char* cmMakefile::GetHomeOutputDirectory() const { - return this->HomeOutputDirectory.c_str(); -} - -void cmMakefile::SetHomeOutputDirectory(const std::string& dir) -{ - this->HomeOutputDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory); - this->AddDefinition("CMAKE_BINARY_DIR", this->GetHomeOutputDirectory()); - if ( !this->GetDefinition("CMAKE_CURRENT_BINARY_DIR") ) - { - this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", - this->GetHomeOutputDirectory()); - } + return this->GetCMakeInstance()->GetHomeOutputDirectory(); } void cmMakefile::SetScriptModeFile(const char* scriptfile) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 46e9391..8968e81 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -74,7 +74,7 @@ public: /** * Construct an empty makefile. */ - cmMakefile(); + cmMakefile(cmLocalGenerator* localGenerator); /** * Destructor. @@ -138,13 +138,6 @@ public: bool GetIsSourceFileTryCompile() const; - /** - * Specify the makefile generator. This is platform/compiler - * dependent, although the interface is through a generic - * superclass. - */ - void SetLocalGenerator(cmLocalGenerator*); - ///! Get the current makefile generator. cmLocalGenerator* GetLocalGenerator() const { return this->LocalGenerator;} @@ -422,19 +415,8 @@ public: bool HasCMP0054AlreadyBeenReported( cmListFileContext context) const; - //@{ - /** - * Set/Get the home directory (or output directory) in the project. The - * home directory is the top directory of the project. It is where - * CMakeSetup or configure was run. Remember that CMake processes - * CMakeLists files by recursing up the tree starting at the StartDirectory - * and going up until it reaches the HomeDirectory. - */ - void SetHomeDirectory(const std::string& dir); const char* GetHomeDirectory() const; - void SetHomeOutputDirectory(const std::string& dir); const char* GetHomeOutputDirectory() const; - //@} /** * Set CMAKE_SCRIPT_MODE_FILE variable when running a -P script. @@ -876,10 +858,6 @@ protected: // Check for a an unused variable void CheckForUnused(const char* reason, const std::string& name) const; - std::string cmStartDirectory; - std::string StartOutputDirectory; - std::string cmHomeDirectory; - std::string HomeOutputDirectory; std::string cmCurrentListFile; std::string ProjectName; // project name @@ -942,7 +920,7 @@ private: cmMakefile& operator=(const cmMakefile& mf); void Initialize(); - + cmState::Snapshot StateSnapshot; bool ReadListFileInternal(const char* filenametoread, bool noPolicyScope, diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 1548c36..91b2b27 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1210,10 +1210,11 @@ static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, cmGlobalGenerator* gg = new cmGlobalGenerator(); gg->SetCMakeInstance(cm); + cm->SetHomeOutputDirectory(targetDirectory); + cm->SetHomeDirectory(targetDirectory); + cmLocalGenerator* lg = gg->CreateLocalGenerator(); - lg->GetMakefile()->SetHomeOutputDirectory(targetDirectory); lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory); - lg->GetMakefile()->SetHomeDirectory(targetDirectory); lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory); gg->SetCurrentLocalGenerator(lg); @@ -1225,6 +1226,8 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, { bool success = true; cmake cm; + cm.SetHomeOutputDirectory(targetDirectory); + cm.SetHomeDirectory(targetDirectory); cmGlobalGenerator* gg = CreateGlobalGenerator(&cm, targetDirectory); cmMakefile* makefile = gg->GetCurrentLocalGenerator()->GetMakefile(); diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 96f8a51..d6899a4 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -22,6 +22,7 @@ cmState::cmState(cmake* cm) : CMakeInstance(cm), IsInTryCompile(false) { + this->CreateSnapshot(Snapshot()); this->Initialize(); } @@ -444,3 +445,72 @@ bool cmState::GetGlobalPropertyAsBool(const std::string& prop) { return cmSystemTools::IsOn(this->GetGlobalProperty(prop)); } + +void cmState::SetSourceDirectory(std::string const& sourceDirectory) +{ + this->SourceDirectory = sourceDirectory; + cmSystemTools::ConvertToUnixSlashes(this->SourceDirectory); +} + +const char* cmState::GetSourceDirectory() const +{ + return this->SourceDirectory.c_str(); +} + +void cmState::SetBinaryDirectory(std::string const& binaryDirectory) +{ + this->BinaryDirectory = binaryDirectory; + cmSystemTools::ConvertToUnixSlashes(this->BinaryDirectory); +} + +const char* cmState::GetBinaryDirectory() const +{ + return this->BinaryDirectory.c_str(); +} + +cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) +{ + PositionType pos = this->ParentPositions.size(); + this->ParentPositions.push_back(originSnapshot.Position); + this->Locations.resize(this->Locations.size() + 1); + this->OutputLocations.resize(this->OutputLocations.size() + 1); + return cmState::Snapshot(this, pos); +} + +cmState::Snapshot::Snapshot(cmState* state, PositionType position) + : State(state), + Position(position) +{ + +} + +const char* cmState::Snapshot::GetCurrentSourceDirectory() const +{ + return this->State->Locations[this->Position].c_str(); +} + +void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) +{ + assert(this->State->Locations.size() > this->Position); + this->State->Locations[this->Position] = dir; + cmSystemTools::ConvertToUnixSlashes( + this->State->Locations[this->Position]); + this->State->Locations[this->Position] = + cmSystemTools::CollapseFullPath(this->State->Locations[this->Position]); +} + +const char* cmState::Snapshot::GetCurrentBinaryDirectory() const +{ + return this->State->OutputLocations[this->Position].c_str(); +} + +void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) +{ + assert(this->State->OutputLocations.size() > this->Position); + this->State->OutputLocations[this->Position] = dir; + cmSystemTools::ConvertToUnixSlashes( + this->State->OutputLocations[this->Position]); + this->State->OutputLocations[this->Position] = + cmSystemTools::CollapseFullPath( + this->State->OutputLocations[this->Position]); +} diff --git a/Source/cmState.h b/Source/cmState.h index 34b2ccf..9902db9 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -21,10 +21,29 @@ class cmCommand; class cmState { + typedef std::vector<std::string>::size_type PositionType; + friend class Snapshot; public: cmState(cmake* cm); ~cmState(); + class Snapshot { + public: + Snapshot(cmState* state = 0, PositionType position = 0); + + const char* GetCurrentSourceDirectory() const; + void SetCurrentSourceDirectory(std::string const& dir); + const char* GetCurrentBinaryDirectory() const; + void SetCurrentBinaryDirectory(std::string const& dir); + + private: + friend class cmState; + cmState* State; + cmState::PositionType Position; + }; + + Snapshot CreateSnapshot(Snapshot originSnapshot); + enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, UNINITIALIZED }; static CacheEntryType StringToCacheEntryType(const char*); @@ -95,12 +114,22 @@ public: const char *GetGlobalProperty(const std::string& prop); bool GetGlobalPropertyAsBool(const std::string& prop); + const char* GetSourceDirectory() const; + void SetSourceDirectory(std::string const& sourceDirectory); + const char* GetBinaryDirectory() const; + void SetBinaryDirectory(std::string const& binaryDirectory); + private: std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions; std::vector<std::string> EnabledLanguages; std::map<std::string, cmCommand*> Commands; cmPropertyMap GlobalProperties; cmake* CMakeInstance; + std::vector<std::string> Locations; + std::vector<std::string> OutputLocations; + std::vector<PositionType> ParentPositions; + std::string SourceDirectory; + std::string BinaryDirectory; bool IsInTryCompile; }; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 439cc54..5c5c428 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -372,13 +372,13 @@ void cmake::ReadListFile(const std::vector<std::string>& args, // read in the list file to fill the cache if(path) { + std::string homeDir = this->GetHomeDirectory(); + std::string homeOutputDir = this->GetHomeOutputDirectory(); + this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); + this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); - lg->GetMakefile()->SetHomeOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); - lg->GetMakefile()->SetHomeDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetCurrentSourceDirectory (cmSystemTools::GetCurrentWorkingDirectory()); if (this->GetWorkingMode() != NORMAL_MODE) @@ -393,6 +393,8 @@ void cmake::ReadListFile(const std::vector<std::string>& args, { cmSystemTools::Error("Error processing file: ", path); } + this->SetHomeDirectory(homeDir); + this->SetHomeOutputDirectory(homeOutputDir); } // free generic one if generated @@ -976,24 +978,22 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname) void cmake::SetHomeDirectory(const std::string& dir) { - this->cmHomeDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory); + this->State->SetSourceDirectory(dir); } const char* cmake::GetHomeDirectory() const { - return this->cmHomeDirectory.c_str(); + return this->State->GetSourceDirectory(); } void cmake::SetHomeOutputDirectory(const std::string& dir) { - this->HomeOutputDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory); + this->State->SetBinaryDirectory(dir); } const char* cmake::GetHomeOutputDirectory() const { - return this->HomeOutputDirectory.c_str(); + return this->State->GetBinaryDirectory(); } void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) diff --git a/Source/cmake.h b/Source/cmake.h index 9dd7c31..0d1977e 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -336,8 +336,6 @@ protected: cmPolicies *Policies; cmGlobalGenerator *GlobalGenerator; cmCacheManager *CacheManager; - std::string cmHomeDirectory; - std::string HomeOutputDirectory; bool SuppressDevWarnings; bool DoSuppressDevWarnings; std::string GeneratorPlatform; |