diff options
author | Brad King <brad.king@kitware.com> | 2012-03-13 13:22:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-03-16 14:18:01 (GMT) |
commit | c68cc0661218c62f32d11cb600183e645c81a3de (patch) | |
tree | f5f9ed60ee709ba8d5adc97e38e41dbfe4aab9cf /Source | |
parent | 48eb7fc7d7b3fa5570a7b32968fa2cff07bf6fe7 (diff) | |
parent | 3a53005f7dd5e582b855ef1f3c0e6814ce7d024a (diff) | |
download | CMake-c68cc0661218c62f32d11cb600183e645c81a3de.zip CMake-c68cc0661218c62f32d11cb600183e645c81a3de.tar.gz CMake-c68cc0661218c62f32d11cb600183e645c81a3de.tar.bz2 |
Merge branch 'object-library' into ninja-object-library
Diffstat (limited to 'Source')
193 files changed, 1745 insertions, 1360 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 18f9b8b..f9d1c03 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -185,6 +185,8 @@ SET(SRCS cmGeneratedFileStream.cxx cmGeneratorExpression.cxx cmGeneratorExpression.h + cmGeneratorTarget.cxx + cmGeneratorTarget.h cmGlobalGenerator.cxx cmGlobalGenerator.h cmGlobalUnixMakefileGenerator3.cxx diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx index 68cde78..d2e3802 100644 --- a/Source/CPack/cmCPackDocumentVariables.cxx +++ b/Source/CPack/cmCPackDocumentVariables.cxx @@ -21,12 +21,60 @@ void cmCPackDocumentVariables::DefineVariables(cmake* cm) "", false, "Variables common to all CPack generators"); - // Subsection: variables defined/used by cpack, - // which are specific to one CPack generator -// cm->DefineProperty -// ("CPACK_RPM_PACKAGE_NAME", cmProperty::VARIABLE, -// "RPM specific package name.", -// "If not specified, defaults to CPACK_PACKAGE_NAME." -// "", false, -// "Variables specific to a CPack generator"); + cm->DefineProperty + ("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", cmProperty::VARIABLE, + "Boolean toggle to include/exclude top level directory.", + "When preparing a package CPack installs the item under" + " the so-called top level directory. The purpose of" + " is to include (set to 1 or ON or TRUE) the top level directory" + " in the package or not (set to 0 or OFF or FALSE).\n" + "Each CPack generator as a built-in default value for this" + " variable. E.g. Archive generators (ZIP, TGZ, ...) includes" + " the top level whereas RPM or DEB don't. The user may override" + " the default value byt setting this variable.\n" + "There is a similar variable " + "CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY" + "which may be used to override the behavior for the component" + "packaging case which may have different default value for" + "historical (now backward compatibility) reason.", false, + "Variables common to all CPack generators"); + + cm->DefineProperty + ("CPACK_SET_DESTDIR", cmProperty::VARIABLE, + "Boolean toggle to make CPack use DESTDIR mechanism when" + " packaging.", "DESTDIR means DESTination DIRectory." + " It is commonly used by makefile " + "users in order to install software at non-default location. It " + "is a basic relocation mechanism. " + "It is usually invoked like this:\n" + " make DESTDIR=/home/john install\n" + "which will install the concerned software using the" + " installation prefix, e.g. \"/usr/local\" prepended with " + "the DESTDIR value which finally gives \"/home/john/usr/local\"." + " When preparing a package, CPack first installs the items to be " + "packaged in a local (to the build tree) directory by using the " + "same DESTDIR mechanism. Nevertheless, if " + "CPACK_SET_DESTDIR is set then CPack will set DESTDIR before" + " doing the local install. The most noticeable difference is" + " that without CPACK_SET_DESTDIR, CPack uses " + "CPACK_PACKAGING_INSTALL_PREFIX as a prefix whereas with " + "CPACK_SET_DESTDIR set, CPack will use CMAKE_INSTALL_PREFIX as" + " a prefix.\n" + "Manually setting CPACK_SET_DESTDIR may help (or simply be" + " necessary) if some install rules uses absolute " + "DESTINATION (see CMake INSTALL command)." + " However, starting with" + " CPack/CMake 2.8.3 RPM and DEB installers tries to handle DESTDIR" + " automatically so that it is seldom necessary for the user to set" + " it.", false, + "Variables common to all CPack generators"); + + cm->DefineProperty + ("CPACK_INSTALL_SCRIPT", cmProperty::VARIABLE, + "Extra CMake script provided by the user.", + "If set this CMake script will be executed by CPack " + "during its local [CPack-private] installation " + "which is done right before packaging the files." + " The script is not called by e.g.: make install.", false, + "Variables common to all CPack generators"); } diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 83b6b64..3b6135e 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -421,6 +421,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, if(ifs.is_open()) { cmGeneratedFileStream osf(sla_r.c_str()); + osf << "#include <CoreServices/CoreServices.r>\n\n"; osf << SLAHeader; osf << "\n"; osf << "data 'TEXT' (5002, \"English\") {\n"; @@ -481,13 +482,11 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, // Rez the SLA cmOStringStream embed_sla_command; - embed_sla_command << "/bin/bash -c \""; // need expansion of "*.r" embed_sla_command << this->GetOption("CPACK_COMMAND_REZ"); - embed_sla_command << " /Developer/Headers/FlatCarbon/*.r "; - embed_sla_command << "'" << sla_r << "'"; + embed_sla_command << " \"" << sla_r << "\""; embed_sla_command << " -a -o "; - embed_sla_command << "'" << temp_udco << "'\""; - + embed_sla_command << "\"" << temp_udco << "\""; + if(!this->RunCommand(embed_sla_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index 9eb4907..cabc39b 100644 --- a/Source/CTest/cmCTestBuildCommand.h +++ b/Source/CTest/cmCTestBuildCommand.h @@ -43,12 +43,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_build";} + virtual const char* GetName() const { return "ctest_build";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Build the project."; } @@ -57,7 +57,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_build([BUILD build_dir] [TARGET target] [RETURN_VALUE res]\n" diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h index 156e6f2..b343fc1 100644 --- a/Source/CTest/cmCTestConfigureCommand.h +++ b/Source/CTest/cmCTestConfigureCommand.h @@ -38,12 +38,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_configure";} + virtual const char* GetName() const { return "ctest_configure";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Configure the project build tree."; } @@ -51,7 +51,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_configure([BUILD build_dir] [SOURCE source_dir] [APPEND]\n" diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h index 25c10dc..2fe762c 100644 --- a/Source/CTest/cmCTestCoverageCommand.h +++ b/Source/CTest/cmCTestCoverageCommand.h @@ -39,12 +39,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_coverage";} + virtual const char* GetName() const { return "ctest_coverage";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Collect coverage tool results."; } @@ -52,7 +52,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_coverage([BUILD build_dir] [RETURN_VALUE res] [APPEND]\n" diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h index cf61045..a763fe9 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h @@ -48,12 +48,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_empty_binary_directory";} + virtual const char* GetName() const { return "ctest_empty_binary_directory";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "empties the binary directory"; } @@ -61,7 +61,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_empty_binary_directory( directory )\n" diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h index 8fa142f..399fe8b 100644 --- a/Source/CTest/cmCTestMemCheckCommand.h +++ b/Source/CTest/cmCTestMemCheckCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_memcheck";} + virtual const char* GetName() const { return "ctest_memcheck";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Run tests with a dynamic analysis tool."; } @@ -54,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_memcheck([BUILD build_dir] [RETURN_VALUE res] [APPEND]\n" diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h index 2213c8f..f382b0f 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.h +++ b/Source/CTest/cmCTestReadCustomFilesCommand.h @@ -46,12 +46,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_read_custom_files";} + virtual const char* GetName() const { return "ctest_read_custom_files";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "read CTestCustom files."; } @@ -59,7 +59,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_read_custom_files( directory ... )\n" diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h index 5765150..6df69af 100644 --- a/Source/CTest/cmCTestRunScriptCommand.h +++ b/Source/CTest/cmCTestRunScriptCommand.h @@ -47,12 +47,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_run_script";} + virtual const char* GetName() const { return "ctest_run_script";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "runs a ctest -S script"; } @@ -60,7 +60,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_run_script([NEW_PROCESS] script_file_name script_file_name1 \n" diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h index 468cd85..80fd6af 100644 --- a/Source/CTest/cmCTestSleepCommand.h +++ b/Source/CTest/cmCTestSleepCommand.h @@ -47,12 +47,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_sleep";} + virtual const char* GetName() const { return "ctest_sleep";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "sleeps for some amount of time"; } @@ -60,7 +60,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_sleep(<seconds>)\n" diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index afbc77b..6be4770 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/Source/CTest/cmCTestStartCommand.h @@ -55,12 +55,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_start";} + virtual const char* GetName() const { return "ctest_start";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Starts the testing for a given model"; } @@ -68,7 +68,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_start(Model [TRACK <track>] [APPEND] [source [binary]])\n" diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h index edc9c65..53ee875 100644 --- a/Source/CTest/cmCTestSubmitCommand.h +++ b/Source/CTest/cmCTestSubmitCommand.h @@ -48,12 +48,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_submit";} + virtual const char* GetName() const { return "ctest_submit";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Submit results to a dashboard server."; } @@ -61,7 +61,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_submit([PARTS ...] [FILES ...] [RETRY_COUNT count] " diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index c6fd631..d184ff2 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -39,12 +39,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_test";} + virtual const char* GetName() const { return "ctest_test";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Run tests in the project build tree."; } @@ -52,7 +52,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_test([BUILD build_dir] [APPEND]\n" diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 9b12393..ead449e 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -59,11 +59,11 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "subdirs";} + virtual const char* GetName() const { return "subdirs";} // Unused methods - virtual const char* GetTerseDocumentation() { return ""; } - virtual const char* GetFullDocumentation() { return ""; } + virtual const char* GetTerseDocumentation() const { return ""; } + virtual const char* GetFullDocumentation() const { return ""; } cmTypeMacro(cmCTestSubdirCommand, cmCommand); @@ -161,11 +161,11 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "add_subdirectory";} + virtual const char* GetName() const { return "add_subdirectory";} // Unused methods - virtual const char* GetTerseDocumentation() { return ""; } - virtual const char* GetFullDocumentation() { return ""; } + virtual const char* GetTerseDocumentation() const { return ""; } + virtual const char* GetFullDocumentation() const { return ""; } cmTypeMacro(cmCTestAddSubdirectoryCommand, cmCommand); @@ -251,11 +251,11 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ADD_TEST";} + virtual const char* GetName() const { return "ADD_TEST";} // Unused methods - virtual const char* GetTerseDocumentation() { return ""; } - virtual const char* GetFullDocumentation() { return ""; } + virtual const char* GetTerseDocumentation() const { return ""; } + virtual const char* GetFullDocumentation() const { return ""; } cmTypeMacro(cmCTestAddTestCommand, cmCommand); @@ -299,11 +299,11 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "SET_TESTS_PROPERTIES";} + virtual const char* GetName() const { return "SET_TESTS_PROPERTIES";} // Unused methods - virtual const char* GetTerseDocumentation() { return ""; } - virtual const char* GetFullDocumentation() { return ""; } + virtual const char* GetTerseDocumentation() const { return ""; } + virtual const char* GetFullDocumentation() const { return ""; } cmTypeMacro(cmCTestSetTestsPropertiesCommand, cmCommand); diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h index 7f36928..c578fff 100644 --- a/Source/CTest/cmCTestUpdateCommand.h +++ b/Source/CTest/cmCTestUpdateCommand.h @@ -39,12 +39,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_update";} + virtual const char* GetName() const { return "ctest_update";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Update the work tree from version control."; } @@ -52,7 +52,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_update([SOURCE source] [RETURN_VALUE res])\n" diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h index 6c2a4c2..62f379f 100644 --- a/Source/CTest/cmCTestUploadCommand.h +++ b/Source/CTest/cmCTestUploadCommand.h @@ -43,12 +43,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_upload";} + virtual const char* GetName() const { return "ctest_upload";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Upload files to a dashboard server."; } @@ -56,7 +56,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_upload(FILES ...)\n" diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h index 05e7dc2..1f770ed 100644 --- a/Source/cmAddCustomCommandCommand.h +++ b/Source/cmAddCustomCommandCommand.h @@ -44,12 +44,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "add_custom_command";} + virtual const char* GetName() const {return "add_custom_command";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add a custom build rule to the generated build system."; } @@ -57,7 +57,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "There are two main signatures for add_custom_command " diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h index 6d94fb2..50bffef 100644 --- a/Source/cmAddCustomTargetCommand.h +++ b/Source/cmAddCustomTargetCommand.h @@ -42,13 +42,13 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() + virtual const char* GetName() const {return "add_custom_target";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add a target with no output so it will always be built."; } @@ -56,7 +56,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " add_custom_target(Name [ALL] [command1 [args1...]]\n" diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h index 0617f04..7bb3767 100644 --- a/Source/cmAddDefinitionsCommand.h +++ b/Source/cmAddDefinitionsCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "add_definitions";} + virtual const char* GetName() const {return "add_definitions";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Adds -D define flags to the compilation of source files."; } @@ -54,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " add_definitions(-DFOO -DBAR ...)\n" diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h index fee011c..14a7741 100644 --- a/Source/cmAddDependenciesCommand.h +++ b/Source/cmAddDependenciesCommand.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "add_dependencies";} + virtual const char* GetName() const { return "add_dependencies";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add a dependency between top-level targets."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " add_dependencies(target-name depend-target1\n" diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h index 6834f58..1e9f9b3 100644 --- a/Source/cmAddExecutableCommand.h +++ b/Source/cmAddExecutableCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "add_executable";} + virtual const char* GetName() const { return "add_executable";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add an executable to the project using the specified source files."; @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " add_executable(<name> [WIN32] [MACOSX_BUNDLE]\n" diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 9a776fb..c1d0e9d 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -64,6 +64,12 @@ bool cmAddLibraryCommand type = cmTarget::MODULE_LIBRARY; haveSpecifiedType = true; } + else if(libType == "OBJECT") + { + ++s; + type = cmTarget::OBJECT_LIBRARY; + haveSpecifiedType = true; + } else if(libType == "UNKNOWN") { ++s; @@ -118,6 +124,14 @@ bool cmAddLibraryCommand this->SetError("called with IMPORTED argument but no library type."); return false; } + if(type == cmTarget::OBJECT_LIBRARY) + { + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + "The OBJECT library type may not be used for IMPORTED libraries." + ); + return true; + } // Make sure the target does not already exist. if(this->Makefile->FindTargetToUse(libName.c_str())) diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h index edca1bb..9ca9cbe 100644 --- a/Source/cmAddLibraryCommand.h +++ b/Source/cmAddLibraryCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "add_library";} + virtual const char* GetName() const { return "add_library";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add a library to the project using the specified source files."; } @@ -54,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " add_library(<name> [STATIC | SHARED | MODULE]\n" diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h index dae705e..3d6f51e 100644 --- a/Source/cmAddSubDirectoryCommand.h +++ b/Source/cmAddSubDirectoryCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "add_subdirectory";} + virtual const char* GetName() const { return "add_subdirectory";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add a subdirectory to the build."; } @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " add_subdirectory(source_dir [binary_dir] \n" diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index edaf12c..59f10f6 100644 --- a/Source/cmAddTestCommand.h +++ b/Source/cmAddTestCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "add_test";} + virtual const char* GetName() const { return "add_test";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add a test to the project with the specified arguments."; } @@ -54,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " add_test(testname Exename arg1 arg2 ... )\n" diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h index 704e2ed..f059e44 100644 --- a/Source/cmAuxSourceDirectoryCommand.h +++ b/Source/cmAuxSourceDirectoryCommand.h @@ -44,12 +44,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "aux_source_directory";} + virtual const char* GetName() const { return "aux_source_directory";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Find all source files in a directory."; } @@ -57,7 +57,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " aux_source_directory(<dir> <variable>)\n" diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h index 72796e8..67ef37e 100644 --- a/Source/cmBreakCommand.h +++ b/Source/cmBreakCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "break";} + virtual const char* GetName() const {return "break";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Break from an enclosing foreach or while loop."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " break()\n" diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h index 1d247d2..a333c5d 100644 --- a/Source/cmBuildCommand.h +++ b/Source/cmBuildCommand.h @@ -50,12 +50,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "build_command";} + virtual const char* GetName() const {return "build_command";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get the command line to build this project."; } @@ -63,7 +63,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " build_command(<variable>\n" diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h index 29a680f..26505a2 100644 --- a/Source/cmBuildNameCommand.h +++ b/Source/cmBuildNameCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "build_name";} + virtual const char* GetName() const {return "build_name";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use ${CMAKE_SYSTEM} and ${CMAKE_CXX_COMPILER} instead."; @@ -59,7 +59,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " build_name(variable)\n" @@ -69,7 +69,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h index 1121386..d23ce79 100644 --- a/Source/cmCMakeMinimumRequired.h +++ b/Source/cmCMakeMinimumRequired.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "cmake_minimum_required";} + virtual const char* GetName() const {return "cmake_minimum_required";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Set the minimum required version of cmake for a project."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " cmake_minimum_required(VERSION major[.minor[.patch[.tweak]]]\n" diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h index afd3001..4f1ed36 100644 --- a/Source/cmCMakePolicyCommand.h +++ b/Source/cmCMakePolicyCommand.h @@ -41,17 +41,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "cmake_policy";} + virtual const char* GetName() const {return "cmake_policy";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Manage CMake Policy settings."; } @@ -59,7 +59,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "As CMake evolves it is sometimes necessary to change existing " diff --git a/Source/cmCommand.h b/Source/cmCommand.h index e046096..4faaee3 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -96,7 +96,7 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() + virtual bool IsScriptable() const { return false; } @@ -105,7 +105,7 @@ public: * This determines if usage of the method is discouraged or not. * This is currently only used for generating the documentation. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return false; } @@ -116,7 +116,7 @@ public: * cmMacroHelperCommand and cmFunctionHelperCommand * which cannot provide appropriate documentation. */ - virtual bool ShouldAppearInDocumentation() + virtual bool ShouldAppearInDocumentation() const { return true; } @@ -124,17 +124,17 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() = 0; + virtual const char* GetName() const = 0; /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() = 0; + virtual const char* GetTerseDocumentation() const = 0; /** * More documentation. */ - virtual const char* GetFullDocumentation() = 0; + virtual const char* GetFullDocumentation() const = 0; /** * Enable the command. @@ -151,7 +151,7 @@ public: /** * Query whether the command is enabled. */ - bool GetEnabled() + bool GetEnabled() const {return this->Enabled;} /** diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index a211e95..cdb832b 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -81,7 +81,6 @@ private: cmStdString InputBuffer; std::vector<char> OutputBuffer; int CurrentLine; - int UnionsAvailable; int Verbose; void Print(const char* place, const char* str); diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 9a075bd..055aab0 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -27,7 +27,7 @@ This file computes an ordered list of link items to use when linking a single target in one configuration. Each link item is identified by the string naming it. A graph of dependencies is created in which -each node corresponds to one item and directed eges lead from nodes to +each node corresponds to one item and directed edges lead from nodes to those which must *follow* them on the link line. For example, the graph @@ -42,7 +42,7 @@ search of the link dependencies starting from the main target. There are two types of items: those with known direct dependencies and those without known dependencies. We will call the two types "known -items" and "unknown items", respecitvely. Known items are those whose +items" and "unknown items", respectively. Known items are those whose names correspond to targets (built or imported) and those for which an old-style <item>_LIB_DEPENDS variable is defined. All other items are unknown and we must infer dependencies for them. For items that look @@ -150,7 +150,7 @@ times the component needs to be seen (once for trivial components, twice for non-trivial). If at any time another component finishes and re-adds an already pending component, the pending component is reset so that it needs to be seen in its entirety again. This ensures that -all dependencies of a component are satisified no matter where it +all dependencies of a component are satisfied no matter where it appears. After the original link line has been completed, we append to it the @@ -633,6 +633,19 @@ cmTarget* cmComputeLinkDepends::FindTargetToLink(int depender_index, tgt = 0; } + if(tgt && tgt->GetType() == cmTarget::OBJECT_LIBRARY) + { + cmOStringStream e; + e << "Target \"" << this->Target->GetName() << "\" links to " + "OBJECT library \"" << tgt->GetName() << "\" but this is not " + "allowed. " + "One may link only to STATIC or SHARED libraries, or to executables " + "with the ENABLE_EXPORTS property set."; + this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->Target->GetBacktrace()); + tgt = 0; + } + // Return the target found, if any. return tgt; } diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 57fd5b4..df78bf8 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1772,6 +1772,7 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs, !linking_for_install); bool use_link_rpath = outputRuntime && linking_for_install && + !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH") && this->Target->GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH"); // Construct the RPATH. diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 8e701c4..ab77c6b 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -31,7 +31,7 @@ dependencies for each target such that no cycles are left and the build order is safe. For most target types cyclic dependencies are not allowed. However -STATIC libraries may depend on each other in a cyclic fasion. In +STATIC libraries may depend on each other in a cyclic fashion. In general the directed dependency graph forms a directed-acyclic-graph of strongly connected components. All strongly connected components should consist of only STATIC_LIBRARY targets. diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h index be33569..de497a9 100644 --- a/Source/cmConfigureFileCommand.h +++ b/Source/cmConfigureFileCommand.h @@ -34,17 +34,17 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "configure_file";} + virtual const char* GetName() const { return "configure_file";} /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Copy a file to another location and modify its contents."; } @@ -52,7 +52,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " configure_file(<input> <output>\n" diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 7d84ba6..48f644b 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -153,11 +153,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) std::string ccFile = this->BinaryDirectory + "/CMakeCache.txt"; cmSystemTools::RemoveFile(ccFile.c_str()); - // we need to create a directory and CMakeList file etc... + // we need to create a directory and CMakeLists file etc... // first create the directories sourceDirectory = this->BinaryDirectory.c_str(); - // now create a CMakeList.txt file in that directory + // now create a CMakeLists.txt file in that directory FILE *fout = fopen(outFileName.c_str(),"w"); if (!fout) { diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index 953328a..de20cb7 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -70,7 +70,7 @@ bool cmCreateTestSourceList if (cmSystemTools::GetFilenameExtension(*i).size() < 2) { this->SetError( - "You must specify a file extenion for the test driver file."); + "You must specify a file extension for the test driver file."); return false; } std::string driver = this->Makefile->GetCurrentOutputDirectory(); diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h index c4c6ae7..806e5a9 100644 --- a/Source/cmCreateTestSourceList.h +++ b/Source/cmCreateTestSourceList.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "create_test_sourcelist";} + virtual const char* GetName() const {return "create_test_sourcelist";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Create a test driver and source list for building test programs."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " create_test_sourcelist(sourceListName driverName\n" diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h index 1fb7801..55ef521 100644 --- a/Source/cmDefinePropertyCommand.h +++ b/Source/cmDefinePropertyCommand.h @@ -32,12 +32,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "define_property";} + virtual const char* GetName() const { return "define_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Define and document custom properties."; } @@ -45,7 +45,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " define_property(<GLOBAL | DIRECTORY | TARGET | SOURCE |\n" diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 94ff471..9296d4c 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -261,11 +261,13 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, void cmDepends::SetIncludePathFromLanguage(const char* lang) { // Look for the new per "TARGET_" variant first: + const char * includePath = 0; std::string includePathVar = "CMAKE_"; includePathVar += lang; includePathVar += "_TARGET_INCLUDE_PATH"; cmMakefile* mf = this->LocalGenerator->GetMakefile(); - if(const char* includePath = mf->GetDefinition(includePathVar.c_str())) + includePath = mf->GetDefinition(includePathVar.c_str()); + if(includePath) { cmSystemTools::ExpandListArgument(includePath, this->IncludePath); } @@ -275,7 +277,8 @@ void cmDepends::SetIncludePathFromLanguage(const char* lang) includePathVar = "CMAKE_"; includePathVar += lang; includePathVar += "_INCLUDE_PATH"; - if(const char* includePath = mf->GetDefinition(includePathVar.c_str())) + includePath = mf->GetDefinition(includePathVar.c_str()); + if(includePath) { cmSystemTools::ExpandListArgument(includePath, this->IncludePath); } diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 9e4726c..c1b6090 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -30,7 +30,7 @@ class cmDependsFortranSourceInfo { public: - // The name of the soruce file. + // The name of the source file. std::string Source; // Set of provided and required modules. @@ -810,8 +810,8 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, * -GNU * -Intel * - * Eat the stream content until all recompile only realated changes - * are left bedind. + * Eat the stream content until all recompile only related changes + * are left behind. */ if (strcmp(compilerId, "GNU") == 0 ) { @@ -852,7 +852,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, } } - // Compare the remainng content. If no compiler id matched above, + // Compare the remaining content. If no compiler id matched above, // including the case none was given, this will compare the whole // content. if(!cmDependsFortranStreamsDiffer(finModFile, finStampFile)) @@ -1209,7 +1209,7 @@ void cmDependsFortranParser_RuleElif(cmDependsFortranParser* parser) * cmDependsFortranParser_RuleIf(..) */ - // Allways taken unless an #ifdef or #ifndef-branch has been taken + // Always taken unless an #ifdef or #ifndef-branch has been taken // already. If the second condition isn't meet already // (parser->InPPFalseBranch == 0) correct it. if(!parser->SkipToEnd.empty() && @@ -1228,7 +1228,7 @@ void cmDependsFortranParser_RuleElse(cmDependsFortranParser* parser) return; } - // parser->InPPFalseBranch is either 0 or 1. We change it denpending on + // parser->InPPFalseBranch is either 0 or 1. We change it depending on // parser->SkipToEnd.top() if(!parser->SkipToEnd.empty() && parser->SkipToEnd.top()) diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 1cab2b5..897e516 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -355,7 +355,9 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "If this is set to TRUE, then the rpath information " "is not added to compiled executables. The default " "is to add rpath information if the platform supports it. " - "This allows for easy running from the build tree.",false, + "This allows for easy running from the build tree. To omit RPATH" + "in the install step, but not the build step, use " + "CMAKE_SKIP_INSTALL_RPATH instead.",false, "Variables that Provide Information"); cm->DefineProperty ("CMAKE_SOURCE_DIR", cmProperty::VARIABLE, @@ -746,6 +748,26 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Variables That Change Behavior"); cm->DefineProperty + ("CMAKE_FIND_PACKAGE_WARN_NO_MODULE", cmProperty::VARIABLE, + "Tell find_package to warn if called without an explicit mode.", + "If find_package is called without an explicit mode option " + "(MODULE, CONFIG or NO_MODULE) and no Find<pkg>.cmake module is " + "in CMAKE_MODULE_PATH then CMake implicitly assumes that the " + "caller intends to search for a package configuration file. " + "If no package configuration file is found then the wording " + "of the failure message must account for both the case that the " + "package is really missing and the case that the project has a " + "bug and failed to provide the intended Find module. " + "If instead the caller specifies an explicit mode option then " + "the failure message can be more specific." + "\n" + "Set CMAKE_FIND_PACKAGE_WARN_NO_MODULE to TRUE to tell find_package " + "to warn when it implicitly assumes Config mode. " + "This helps developers enforce use of an explicit mode in all calls " + "to find_package within a project.", false, + "Variables That Change Behavior"); + + cm->DefineProperty ("CMAKE_USER_MAKE_RULES_OVERRIDE", cmProperty::VARIABLE, "Specify a CMake file that overrides platform information.", "CMake loads the specified file while enabling support for each " @@ -895,7 +917,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cm->DefineProperty ("BORLAND", cmProperty::VARIABLE, - "True of the borland compiler is being used.", + "True if the borland compiler is being used.", "This is set to true if the Borland compiler is being used.",false, "Variables That Describe the System"); @@ -1181,6 +1203,20 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Variables that Control the Build"); cm->DefineProperty + ("CMAKE_SKIP_INSTALL_RPATH", cmProperty::VARIABLE, + "Do not include RPATHs in the install tree.", + "Normally CMake uses the build tree for the RPATH when building " + "executables etc on systems that use RPATH. When the software " + "is installed the executables etc are relinked by CMake to have " + "the install RPATH. If this variable is set to true then the software " + "is always installed without RPATH, even if RPATH is enabled when " + "building. This can be useful for example to allow running tests from " + "the build directory with RPATH enabled before the installation step. " + "To omit RPATH in both the build and install steps, use " + "CMAKE_SKIP_RPATH instead.",false, + "Variables that Control the Build"); + + cm->DefineProperty ("CMAKE_EXE_LINKER_FLAGS", cmProperty::VARIABLE, "Linker flags used to create executables.", "Flags used by the linker when creating an executable.",false, @@ -1258,6 +1294,22 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "See that target property for additional information.", false, "Variables that Control the Build"); + cm->DefineProperty + ("CMAKE_WIN32_EXECUTABLE", cmProperty::VARIABLE, + "Default value for WIN32_EXECUTABLE of targets.", + "This variable is used to initialize the " + "WIN32_EXECUTABLE property on all the targets. " + "See that target property for additional information.", + false, + "Variables that Control the Build"); + cm->DefineProperty + ("CMAKE_MACOSX_BUNDLE", cmProperty::VARIABLE, + "Default value for MACOSX_BUNDLE of targets.", + "This variable is used to initialize the " + "MACOSX_BUNDLE property on all the targets. " + "See that target property for additional information.", + false, + "Variables that Control the Build"); // Variables defined when the a language is enabled These variables will // also be defined whenever CMake has loaded its support for compiling (LANG) diff --git a/Source/cmElseCommand.h b/Source/cmElseCommand.h index bbe31f4..5e8b790 100644 --- a/Source/cmElseCommand.h +++ b/Source/cmElseCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "else";} + virtual const char* GetName() const { return "else";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Starts the else portion of an if block."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " else(expression)\n" diff --git a/Source/cmElseIfCommand.h b/Source/cmElseIfCommand.h index cca5fb8..20cd81a 100644 --- a/Source/cmElseIfCommand.h +++ b/Source/cmElseIfCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "elseif";} + virtual const char* GetName() const { return "elseif";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Starts the elseif portion of an if block."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " elseif(expression)\n" diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h index e934119..5958e44 100644 --- a/Source/cmEnableLanguageCommand.h +++ b/Source/cmEnableLanguageCommand.h @@ -43,12 +43,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "enable_language";} + virtual const char* GetName() const {return "enable_language";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Enable a language (CXX/C/Fortran/etc)"; } @@ -56,7 +56,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " enable_language(languageName [OPTIONAL] )\n" diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h index 7361241..b607818 100644 --- a/Source/cmEnableTestingCommand.h +++ b/Source/cmEnableTestingCommand.h @@ -48,12 +48,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "enable_testing";} + virtual const char* GetName() const { return "enable_testing";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Enable testing for current directory and below."; } @@ -61,7 +61,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " enable_testing()\n" diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h index 7ceb39d..37b2d2a 100644 --- a/Source/cmEndForEachCommand.h +++ b/Source/cmEndForEachCommand.h @@ -47,17 +47,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "endforeach";} + virtual const char* GetName() const { return "endforeach";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Ends a list of commands in a FOREACH block."; } @@ -65,7 +65,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " endforeach(expression)\n" diff --git a/Source/cmEndFunctionCommand.h b/Source/cmEndFunctionCommand.h index 2d58c9d..54ac068 100644 --- a/Source/cmEndFunctionCommand.h +++ b/Source/cmEndFunctionCommand.h @@ -47,17 +47,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "endfunction";} + virtual const char* GetName() const { return "endfunction";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Ends a list of commands in a function block."; } @@ -65,7 +65,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " endfunction(expression)\n" diff --git a/Source/cmEndIfCommand.h b/Source/cmEndIfCommand.h index f0af8c6..81d1b5f 100644 --- a/Source/cmEndIfCommand.h +++ b/Source/cmEndIfCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "endif";} + virtual const char* GetName() const { return "endif";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Ends a list of commands in an if block."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " endif(expression)\n" diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h index 52b7e82..25e86b7 100644 --- a/Source/cmEndMacroCommand.h +++ b/Source/cmEndMacroCommand.h @@ -47,17 +47,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "endmacro";} + virtual const char* GetName() const { return "endmacro";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Ends a list of commands in a macro block."; } @@ -65,7 +65,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " endmacro(expression)\n" diff --git a/Source/cmEndWhileCommand.cxx b/Source/cmEndWhileCommand.cxx index bb4d40a..abb9e5e 100644 --- a/Source/cmEndWhileCommand.cxx +++ b/Source/cmEndWhileCommand.cxx @@ -12,12 +12,21 @@ #include "cmEndWhileCommand.h" bool cmEndWhileCommand -::InvokeInitialPass(std::vector<cmListFileArgument> const&, +::InvokeInitialPass(std::vector<cmListFileArgument> const& args, cmExecutionStatus &) { - this->SetError("An ENDWHILE command was found outside of a proper " - "WHILE ENDWHILE structure. Or its arguments did not " - "match the opening WHILE command."); + if (args.empty()) + { + this->SetError("An ENDWHILE command was found outside of a proper " + "WHILE ENDWHILE structure."); + } + else + { + this->SetError("An ENDWHILE command was found outside of a proper " + "WHILE ENDWHILE structure. Or its arguments did not " + "match the opening WHILE command."); + } + return false; } diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h index 8e0b488..635ad5a 100644 --- a/Source/cmEndWhileCommand.h +++ b/Source/cmEndWhileCommand.h @@ -34,7 +34,7 @@ public: * Override cmCommand::InvokeInitialPass to get arguments before * expansion. */ - virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&, + virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const& args, cmExecutionStatus &status); /** @@ -47,17 +47,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "endwhile";} + virtual const char* GetName() const { return "endwhile";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Ends a list of commands in a while block."; } @@ -65,7 +65,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " endwhile(expression)\n" diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h index ef3a732..7233860 100644 --- a/Source/cmExecProgramCommand.h +++ b/Source/cmExecProgramCommand.h @@ -42,18 +42,18 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() + virtual const char* GetName() const {return "exec_program";} /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the execute_process() command instead."; @@ -62,7 +62,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "Run an executable program during the processing of the CMakeList.txt" @@ -84,7 +84,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h index 3cd8f01..0e20a4b 100644 --- a/Source/cmExecuteProcessCommand.h +++ b/Source/cmExecuteProcessCommand.h @@ -41,18 +41,18 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() + virtual const char* GetName() const {return "execute_process";} /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Execute one or more child processes."; } @@ -60,7 +60,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " execute_process(COMMAND <cmd1> [args1...]]\n" diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index cb614d4..1cc1754 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -124,6 +124,14 @@ bool cmExportCommand { targets.push_back(target); } + else if(target->GetType() == cmTarget::OBJECT_LIBRARY) + { + cmOStringStream e; + e << "given OBJECT library \"" << *currentTarget + << "\" which may not be exported."; + this->SetError(e.str().c_str()); + return false; + } else { cmOStringStream e; diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index eb19d2e..ae67b47 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -45,12 +45,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "export";} + virtual const char* GetName() const { return "export";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Export targets from the build tree for use by outside projects."; @@ -59,7 +59,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " export(TARGETS [target1 [target2 [...]]] [NAMESPACE <namespace>]\n" diff --git a/Source/cmExportLibraryDependencies.h b/Source/cmExportLibraryDependencies.h index 32c262f..2a2ff21 100644 --- a/Source/cmExportLibraryDependencies.h +++ b/Source/cmExportLibraryDependencies.h @@ -48,12 +48,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "export_library_dependencies";} + virtual const char* GetName() const { return "export_library_dependencies";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use INSTALL(EXPORT) or EXPORT command."; } @@ -61,7 +61,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "This command generates an old-style library dependencies file. " @@ -83,7 +83,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index ee37352..7728d74 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -30,12 +30,6 @@ cmExprParserHelper::~cmExprParserHelper() this->CleanupParser(); } -void cmExprParserHelper::SetLineFile(long line, const char* file) -{ - this->FileLine = line; - this->FileName = file; -} - int cmExprParserHelper::ParseString(const char* str, int verb) { if ( !str) diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index 0c36b44..690426d 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -46,8 +46,6 @@ public: int GetResult() { return this->Result; } - void SetLineFile(long line, const char* file); - const char* GetError() { return this->ErrorString.c_str(); } private: @@ -55,7 +53,6 @@ private: cmStdString InputBuffer; std::vector<char> OutputBuffer; int CurrentLine; - int UnionsAvailable; int Verbose; void Print(const char* place, const char* str); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index b5cba8e..ccb17f0 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -392,10 +392,6 @@ void cmExtraCodeBlocksGenerator make.c_str(), makefile, compiler.c_str()); } break; - // ignore these: - case cmTarget::INSTALL_FILES: - case cmTarget::INSTALL_PROGRAMS: - case cmTarget::INSTALL_DIRECTORY: default: break; } diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 19372c8..ebd7c7f 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -1049,10 +1049,6 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const } } break; - // ignore these: - case cmTarget::INSTALL_FILES: - case cmTarget::INSTALL_PROGRAMS: - case cmTarget::INSTALL_DIRECTORY: default: break; } diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h index 6ecdbcc..cb0f9d5 100644 --- a/Source/cmFLTKWrapUICommand.h +++ b/Source/cmFLTKWrapUICommand.h @@ -52,12 +52,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "fltk_wrap_ui";} + virtual const char* GetName() const { return "fltk_wrap_ui";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Create FLTK user interfaces Wrappers."; } @@ -65,7 +65,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " fltk_wrap_ui(resultingLibraryName source1\n" diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 6df5ab3..3f14fa1 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -12,6 +12,7 @@ #include "cmFileCommand.h" #include "cmake.h" #include "cmHexFileConverter.h" +#include "cmInstallType.h" #include "cmFileTimeComparison.h" #include "cmCryptoHash.h" @@ -1690,7 +1691,7 @@ struct cmFileInstaller: public cmFileCopier { cmFileInstaller(cmFileCommand* command): cmFileCopier(command, "INSTALL"), - InstallType(cmTarget::INSTALL_FILES), + InstallType(cmInstallType_FILES), Optional(false), DestDirLength(0) { @@ -1711,7 +1712,7 @@ struct cmFileInstaller: public cmFileCopier } protected: - cmTarget::TargetType InstallType; + cmInstallType InstallType; bool Optional; int DestDirLength; std::string Rename; @@ -1745,7 +1746,7 @@ protected: virtual bool Install(const char* fromFile, const char* toFile) { // Support installing from empty source to make a directory. - if(this->InstallType == cmTarget::INSTALL_DIRECTORY && !*fromFile) + if(this->InstallType == cmInstallType_DIRECTORY && !*fromFile) { return this->InstallDirectory(fromFile, toFile, MatchProperties()); } @@ -1767,14 +1768,14 @@ protected: // Add execute permissions based on the target type. switch(this->InstallType) { - case cmTarget::SHARED_LIBRARY: - case cmTarget::MODULE_LIBRARY: + case cmInstallType_SHARED_LIBRARY: + case cmInstallType_MODULE_LIBRARY: if(this->Makefile->IsOn("CMAKE_INSTALL_SO_NO_EXE")) { break; } - case cmTarget::EXECUTABLE: - case cmTarget::INSTALL_PROGRAMS: + case cmInstallType_EXECUTABLE: + case cmInstallType_PROGRAMS: this->FilePermissions |= mode_owner_execute; this->FilePermissions |= mode_group_execute; this->FilePermissions |= mode_world_execute; @@ -1796,8 +1797,8 @@ bool cmFileInstaller::Parse(std::vector<std::string> const& args) if(!this->Rename.empty()) { - if(this->InstallType != cmTarget::INSTALL_FILES && - this->InstallType != cmTarget::INSTALL_PROGRAMS) + if(this->InstallType != cmInstallType_FILES && + this->InstallType != cmInstallType_PROGRAMS) { this->FileCommand->SetError("INSTALL option RENAME may be used " "only with FILES or PROGRAMS."); @@ -1936,31 +1937,31 @@ bool cmFileInstaller { if ( stype == "EXECUTABLE" ) { - this->InstallType = cmTarget::EXECUTABLE; + this->InstallType = cmInstallType_EXECUTABLE; } else if ( stype == "FILE" ) { - this->InstallType = cmTarget::INSTALL_FILES; + this->InstallType = cmInstallType_FILES; } else if ( stype == "PROGRAM" ) { - this->InstallType = cmTarget::INSTALL_PROGRAMS; + this->InstallType = cmInstallType_PROGRAMS; } else if ( stype == "STATIC_LIBRARY" ) { - this->InstallType = cmTarget::STATIC_LIBRARY; + this->InstallType = cmInstallType_STATIC_LIBRARY; } else if ( stype == "SHARED_LIBRARY" ) { - this->InstallType = cmTarget::SHARED_LIBRARY; + this->InstallType = cmInstallType_SHARED_LIBRARY; } else if ( stype == "MODULE" ) { - this->InstallType = cmTarget::MODULE_LIBRARY; + this->InstallType = cmInstallType_MODULE_LIBRARY; } else if ( stype == "DIRECTORY" ) { - this->InstallType = cmTarget::INSTALL_DIRECTORY; + this->InstallType = cmInstallType_DIRECTORY; } else { diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 9e2ed0f..3b368fa 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -41,17 +41,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "file";} + virtual const char* GetName() const { return "file";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "File manipulation command."; } @@ -59,7 +59,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " file(WRITE filename \"message to write\"... )\n" diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 183da4a..fb8bcf7 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -108,11 +108,11 @@ void cmFindBase::GenerateDocumentation() } //---------------------------------------------------------------------------- -const char* cmFindBase::GetFullDocumentation() +const char* cmFindBase::GetFullDocumentation() const { if(this->GenericDocumentation.empty()) { - this->GenerateDocumentation(); + const_cast<cmFindBase *>(this)->GenerateDocumentation(); } return this->GenericDocumentation.c_str(); } diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h index de319b1..37ab2ec 100644 --- a/Source/cmFindBase.h +++ b/Source/cmFindBase.h @@ -31,7 +31,7 @@ public: virtual bool ParseArguments(std::vector<std::string> const& args); cmTypeMacro(cmFindBase, cmFindCommon); - virtual const char* GetFullDocumentation(); + virtual const char* GetFullDocumentation() const; protected: virtual void GenerateDocumentation(); diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h index dd2e01d..7d349d3 100644 --- a/Source/cmFindFileCommand.h +++ b/Source/cmFindFileCommand.h @@ -33,12 +33,12 @@ public: { return new cmFindFileCommand; } - virtual const char* GetName() { return "find_file";} + virtual const char* GetName() const { return "find_file";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Find the full path to a file."; } diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index 7930f52..b880be2 100644 --- a/Source/cmFindLibraryCommand.h +++ b/Source/cmFindLibraryCommand.h @@ -44,17 +44,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "find_library";} + virtual const char* GetName() const {return "find_library";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Find a library."; } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 22bb628..f17002e 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -57,7 +57,8 @@ cmFindPackageCommand::cmFindPackageCommand() this->NoUserRegistry = false; this->NoSystemRegistry = false; this->NoBuilds = false; - this->NoModule = false; + this->UseConfigFiles = true; + this->UseFindModules = true; this->DebugMode = false; this->UseLib64Paths = false; this->PolicyScope = true; @@ -72,6 +73,7 @@ cmFindPackageCommand::cmFindPackageCommand() this->VersionFoundPatch = 0; this->VersionFoundTweak = 0; this->VersionFoundCount = 0; + this->RequiredCMakeVersion = 0; } //---------------------------------------------------------------------------- @@ -86,7 +88,7 @@ void cmFindPackageCommand::GenerateDocumentation() cmSystemTools::ReplaceString(this->GenericDocumentationPathsOrder, "FIND_XXX", "find_package"); this->CommandDocumentation = - " find_package(<package> [version] [EXACT] [QUIET]\n" + " find_package(<package> [version] [EXACT] [QUIET] [MODULE]\n" " [[REQUIRED|COMPONENTS] [components...]]\n" " [NO_POLICY_SCOPE])\n" "Finds and loads settings from an external project. " @@ -94,6 +96,7 @@ void cmFindPackageCommand::GenerateDocumentation() "When the package is found package-specific information is provided " "through variables documented by the package itself. " "The QUIET option disables messages if the package cannot be found. " + "The MODULE option disables the second signature documented below. " "The REQUIRED option stops processing with an error message if the " "package cannot be found. " "A package-specific list of components may be listed after the " @@ -124,10 +127,12 @@ void cmFindPackageCommand::GenerateDocumentation() "and producing any needed messages. " "Many find-modules provide limited or no support for versioning; " "check the module documentation. " - "If no module is found the command proceeds to Config mode.\n" + "If no module is found and the MODULE option is not given the command " + "proceeds to Config mode.\n" "The complete Config mode command signature is:\n" " find_package(<package> [version] [EXACT] [QUIET]\n" - " [[REQUIRED|COMPONENTS] [components...]] [NO_MODULE]\n" + " [[REQUIRED|COMPONENTS] [components...]]\n" + " [CONFIG|NO_MODULE]\n" " [NO_POLICY_SCOPE]\n" " [NAMES name1 [name2 ...]]\n" " [CONFIGS config1 [config2 ...]]\n" @@ -145,9 +150,10 @@ void cmFindPackageCommand::GenerateDocumentation() " [CMAKE_FIND_ROOT_PATH_BOTH |\n" " ONLY_CMAKE_FIND_ROOT_PATH |\n" " NO_CMAKE_FIND_ROOT_PATH])\n" - "The NO_MODULE option may be used to skip Module mode explicitly. " - "It is also implied by use of options not specified in the reduced " - "signature. " + "The CONFIG option may be used to skip Module mode explicitly and " + "switch to Config mode. It is synonymous to using NO_MODULE. " + "Config mode is also implied by use of options not specified in the " + "reduced signature. " "\n" "Config mode attempts to locate a configuration file provided by the " "package to be found. A cache entry called <package>_DIR is created to " @@ -192,7 +198,7 @@ void cmFindPackageCommand::GenerateDocumentation() "If no such version file is available then the configuration file " "is assumed to not be compatible with any requested version. " "A basic version file containing generic version matching code can be " - "created using the macro write_basic_config_version_file(), see its " + "created using the macro write_basic_package_version_file(), see its " "documentation for more details. " "When a version file is found it is loaded to check the requested " "version number. " @@ -348,11 +354,11 @@ void cmFindPackageCommand::GenerateDocumentation() } //---------------------------------------------------------------------------- -const char* cmFindPackageCommand::GetFullDocumentation() +const char* cmFindPackageCommand::GetFullDocumentation() const { if(this->CommandDocumentation.empty()) { - this->GenerateDocumentation(); + const_cast<cmFindPackageCommand *>(this)->GenerateDocumentation(); } return this->CommandDocumentation.c_str(); } @@ -367,6 +373,15 @@ bool cmFindPackageCommand return false; } + // Lookup required version of CMake. + if(const char* rv = + this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION")) + { + unsigned int v[3] = {0,0,0}; + sscanf(rv, "%u.%u.%u", &v[0], &v[1], &v[2]); + this->RequiredCMakeVersion = CMake_VERSION_ENCODE(v[0],v[1],v[2]); + } + // Check for debug mode. this->DebugMode = this->Makefile->IsOn("CMAKE_FIND_DEBUG_MODE"); @@ -410,6 +425,8 @@ bool cmFindPackageCommand Doing doing = DoingNone; cmsys::RegularExpression version("^[0-9.]+$"); bool haveVersion = false; + std::set<unsigned int> configArgs; + std::set<unsigned int> moduleArgs; for(unsigned int i=1; i < args.size(); ++i) { if(args[i] == "QUIET") @@ -423,9 +440,19 @@ bool cmFindPackageCommand this->Compatibility_1_6 = false; doing = DoingNone; } + else if(args[i] == "MODULE") + { + moduleArgs.insert(i); + doing = DoingNone; + } + else if(args[i] == "CONFIG") + { + configArgs.insert(i); + doing = DoingNone; + } else if(args[i] == "NO_MODULE") { - this->NoModule = true; + configArgs.insert(i); doing = DoingNone; } else if(args[i] == "REQUIRED") @@ -440,31 +467,31 @@ bool cmFindPackageCommand } else if(args[i] == "NAMES") { - this->NoModule = true; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingNames; } else if(args[i] == "PATHS") { - this->NoModule = true; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingPaths; } else if(args[i] == "HINTS") { - this->NoModule = true; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingHints; } else if(args[i] == "PATH_SUFFIXES") { - this->NoModule = true; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingPathSuffixes; } else if(args[i] == "CONFIGS") { - this->NoModule = true; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingConfigs; } @@ -477,27 +504,27 @@ bool cmFindPackageCommand else if(args[i] == "NO_CMAKE_PACKAGE_REGISTRY") { this->NoUserRegistry = true; - this->NoModule = true; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingNone; } else if(args[i] == "NO_CMAKE_SYSTEM_PACKAGE_REGISTRY") { this->NoSystemRegistry = true; - this->NoModule = true; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingNone; } else if(args[i] == "NO_CMAKE_BUILDS_PATH") { this->NoBuilds = true; - this->NoModule = true; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingNone; } else if(this->CheckCommonArgument(args[i])) { - this->NoModule = true; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingNone; } @@ -538,6 +565,7 @@ bool cmFindPackageCommand e << "given CONFIGS option followed by invalid file name \"" << args[i] << "\". The names given must be file names without " << "a path and with a \".cmake\" extension."; + this->SetError(e.str().c_str()); return false; } this->Configs.push_back(args[i]); @@ -556,6 +584,29 @@ bool cmFindPackageCommand } } + // Maybe choose one mode exclusively. + this->UseFindModules = configArgs.empty(); + this->UseConfigFiles = moduleArgs.empty(); + if(!this->UseFindModules && !this->UseConfigFiles) + { + cmOStringStream e; + e << "given options exclusive to Module mode:\n"; + for(std::set<unsigned int>::const_iterator si = moduleArgs.begin(); + si != moduleArgs.end(); ++si) + { + e << " " << args[*si] << "\n"; + } + e << "and options exclusive to Config mode:\n"; + for(std::set<unsigned int>::const_iterator si = configArgs.begin(); + si != configArgs.end(); ++si) + { + e << " " << args[*si] << "\n"; + } + e << "The options are incompatible."; + this->SetError(e.str().c_str()); + return false; + } + // Ignore EXACT with no version. if(this->Version.empty() && this->VersionExact) { @@ -635,7 +686,7 @@ bool cmFindPackageCommand this->SetModuleVariables(components); // See if there is a Find<package>.cmake module. - if(!this->NoModule) + if(this->UseFindModules) { bool foundModule = false; if(!this->FindModule(foundModule)) @@ -650,6 +701,37 @@ bool cmFindPackageCommand } } + if(this->UseFindModules && this->UseConfigFiles && + this->Makefile->IsOn("CMAKE_FIND_PACKAGE_WARN_NO_MODULE")) + { + cmOStringStream aw; + if(this->RequiredCMakeVersion >= CMake_VERSION_ENCODE(2,8,8)) + { + aw << "find_package called without either MODULE or CONFIG option and " + "no Find" << this->Name << ".cmake module is in CMAKE_MODULE_PATH. " + "Add MODULE to exclusively request Module mode and fail if " + "Find" << this->Name << ".cmake is missing. " + "Add CONFIG to exclusively request Config mode and search for a " + "package configuration file provided by " << this->Name << + " (" << this->Name << "Config.cmake or " << + cmSystemTools::LowerCase(this->Name) << "-config.cmake). "; + } + else + { + aw << "find_package called without NO_MODULE option and no " + "Find" << this->Name << ".cmake module is in CMAKE_MODULE_PATH. " + "Add NO_MODULE to exclusively request Config mode and search for a " + "package configuration file provided by " << this->Name << + " (" << this->Name << "Config.cmake or " << + cmSystemTools::LowerCase(this->Name) << "-config.cmake). " + "Otherwise make Find" << this->Name << ".cmake available in " + "CMAKE_MODULE_PATH."; + } + aw << "\n" + "(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.)"; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, aw.str()); + } + // No find module. Assume the project has a CMake config file. Use // a <package>_DIR cache variable to locate it. this->Variable = this->Name; @@ -830,41 +912,44 @@ bool cmFindPackageCommand::HandlePackageMode() // Try to load the config file if the directory is known bool fileFound = false; - if(!cmSystemTools::IsOff(def)) + if (this->UseConfigFiles) { - // Get the directory from the variable value. - std::string dir = def; - cmSystemTools::ConvertToUnixSlashes(dir); - - // Treat relative paths with respect to the current source dir. - if(!cmSystemTools::FileIsFullPath(dir.c_str())) + if(!cmSystemTools::IsOff(def)) { - dir = "/" + dir; - dir = this->Makefile->GetCurrentDirectory() + dir; + // Get the directory from the variable value. + std::string dir = def; + cmSystemTools::ConvertToUnixSlashes(dir); + + // Treat relative paths with respect to the current source dir. + if(!cmSystemTools::FileIsFullPath(dir.c_str())) + { + dir = "/" + dir; + dir = this->Makefile->GetCurrentDirectory() + dir; + } + // The file location was cached. Look for the correct file. + std::string file; + if (this->FindConfigFile(dir, file)) + { + this->FileFound = file; + fileFound = true; + } + def = this->Makefile->GetDefinition(this->Variable.c_str()); } - // The file location was cached. Look for the correct file. - std::string file; - if (this->FindConfigFile(dir, file)) + + // Search for the config file if it is not already found. + if(cmSystemTools::IsOff(def) || !fileFound) { - this->FileFound = file; - fileFound = true; + fileFound = this->FindConfig(); + def = this->Makefile->GetDefinition(this->Variable.c_str()); } - def = this->Makefile->GetDefinition(this->Variable.c_str()); - } - // Search for the config file if it is not already found. - if(cmSystemTools::IsOff(def) || !fileFound) - { - fileFound = this->FindConfig(); - def = this->Makefile->GetDefinition(this->Variable.c_str()); - } - - // Sanity check. - if(fileFound && this->FileFound.empty()) - { - this->Makefile->IssueMessage( - cmake::INTERNAL_ERROR, "fileFound is true but FileFound is empty!"); - fileFound = false; + // Sanity check. + if(fileFound && this->FileFound.empty()) + { + this->Makefile->IssueMessage( + cmake::INTERNAL_ERROR, "fileFound is true but FileFound is empty!"); + fileFound = false; + } } // If the directory for the config file was found, try to read the file. @@ -892,6 +977,7 @@ bool cmFindPackageCommand::HandlePackageMode() { // The variable is not set. cmOStringStream e; + cmOStringStream aw; // If there are files in ConsideredConfigs, it means that FooConfig.cmake // have been found, but they didn't have appropriate versions. if (this->ConsideredConfigs.size() > 0) @@ -911,41 +997,80 @@ bool cmFindPackageCommand::HandlePackageMode() } else { - e << "Could not find "; - if(!this->NoModule) - { - e << "module Find" << this->Name << ".cmake or "; - } - e << "a configuration file for package " << this->Name << ".\n"; - if(!this->NoModule) + std::string requestedVersionString; + if(!this->Version.empty()) { - e << "Adjust CMAKE_MODULE_PATH to find Find" - << this->Name << ".cmake or set "; + requestedVersionString = " (requested version "; + requestedVersionString += this->Version; + requestedVersionString += ")"; } - else - { - e << "Set "; - } - e << this->Variable << " to the directory containing a CMake " - << "configuration file for " << this->Name << ". "; - if(this->Configs.size() == 1) - { - e << "The file will be called " << this->Configs[0]; - } - else + + if (this->UseConfigFiles) { - e << "The file will have one of the following names:\n"; - for(std::vector<std::string>::const_iterator ci=this->Configs.begin(); - ci != this->Configs.end(); ++ci) + if(this->UseFindModules) { - e << " " << *ci << "\n"; + e << "By not providing \"Find" << this->Name << ".cmake\" in " + "CMAKE_MODULE_PATH this project has asked CMake to find a " + "package configuration file provided by \""<<this->Name<< "\", " + "but CMake did not find one.\n"; } + + if(this->Configs.size() == 1) + { + e << "Could not find a package configuration file named \"" + << this->Configs[0] << "\" provided by package \"" + << this->Name << "\"" << requestedVersionString <<".\n"; + } + else + { + e << "Could not find a package configuration file provided by \"" + << this->Name << "\"" << requestedVersionString + << " with any of the following names:\n"; + for(std::vector<std::string>::const_iterator ci = + this->Configs.begin(); + ci != this->Configs.end(); ++ci) + { + e << " " << *ci << "\n"; + } + } + + e << "Add the installation prefix of \"" << this->Name << "\" to " + "CMAKE_PREFIX_PATH or set \"" << this->Variable << "\" to a " + "directory containing one of the above files. " + "If \"" << this->Name << "\" provides a separate development " + "package or SDK, be sure it has been installed."; + } + else // if(!this->UseFindModules && !this->UseConfigFiles) + { + e << "No \"Find" << this->Name << ".cmake\" found in " + << "CMAKE_MODULE_PATH."; + + aw<< "Find"<< this->Name <<".cmake must either be part of this " + "project itself, in this case adjust CMAKE_MODULE_PATH so that " + "it points to the correct location inside its source tree.\n" + "Or it must be installed by a package which has already been " + "found via find_package(). In this case make sure that " + "package has indeed been found and adjust CMAKE_MODULE_PATH to " + "contain the location where that package has installed " + "Find" << this->Name << ".cmake. This must be a location " + "provided by that package. This error in general means that " + "the buildsystem of this project is relying on a Find-module " + "without ensuring that it is actually available.\n"; } } this->Makefile->IssueMessage( this->Required? cmake::FATAL_ERROR : cmake::WARNING, e.str()); + if (this->Required) + { + cmSystemTools::SetFatalErrorOccured(); + } + + if (!aw.str().empty()) + { + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,aw.str()); + } } // Set a variable marking whether the package was found. diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index e736352..edb70a6 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -44,17 +44,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "find_package";} + virtual const char* GetName() const { return "find_package";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Load settings for an external project."; } @@ -62,7 +62,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation(); + virtual const char* GetFullDocumentation() const; cmTypeMacro(cmFindPackageCommand, cmFindCommon); protected: @@ -130,10 +130,12 @@ private: unsigned int VersionFoundPatch; unsigned int VersionFoundTweak; unsigned int VersionFoundCount; + unsigned int RequiredCMakeVersion; bool Quiet; bool Required; bool Compatibility_1_6; - bool NoModule; + bool UseConfigFiles; + bool UseFindModules; bool NoUserRegistry; bool NoSystemRegistry; bool NoBuilds; diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h index bd94779..a612990 100644 --- a/Source/cmFindPathCommand.h +++ b/Source/cmFindPathCommand.h @@ -44,17 +44,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "find_path";} + virtual const char* GetName() const {return "find_path";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Find the directory containing a file."; } diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 7c56ad7..00f5419 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -175,6 +175,8 @@ std::string cmFindProgramCommand::GetBundleExecutable(std::string bundlePath) // And finally to a c++ string executable = bundlePath + "/Contents/MacOS/" + std::string(buffer); + // Only release CFURLRef if it's not null + CFRelease( executableURL ); } // Any CF objects returned from functions with "create" or @@ -182,7 +184,6 @@ std::string cmFindProgramCommand::GetBundleExecutable(std::string bundlePath) CFRelease( bundlePathCFS ); CFRelease( bundleURL ); CFRelease( appBundle ); - CFRelease( executableURL ); #endif return executable; diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h index 654e834..c1b14f9 100644 --- a/Source/cmFindProgramCommand.h +++ b/Source/cmFindProgramCommand.h @@ -43,17 +43,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "find_program";} + virtual const char* GetName() const { return "find_program";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Find an executable program."; } diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h index 026fd31..ae50005 100644 --- a/Source/cmForEachCommand.h +++ b/Source/cmForEachCommand.h @@ -16,11 +16,6 @@ #include "cmFunctionBlocker.h" #include "cmListFileCache.h" -/** \class cmForEachFunctionBlocker - * \brief subclass of function blocker - * - * - */ class cmForEachFunctionBlocker : public cmFunctionBlocker { public: @@ -37,11 +32,7 @@ private: int Depth; }; -/** \class cmForEachCommand - * \brief starts an if block - * - * cmForEachCommand starts an if block - */ +/// Starts foreach() ... endforeach() block class cmForEachCommand : public cmCommand { public: @@ -63,17 +54,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "foreach";} + virtual const char* GetName() const { return "foreach";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Evaluate a group of commands for each value in a list."; } @@ -81,7 +72,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " foreach(loop_var arg1 arg2 ...)\n" diff --git a/Source/cmFunctionBlocker.h b/Source/cmFunctionBlocker.h index c3b29e1..9ee0b5c 100644 --- a/Source/cmFunctionBlocker.h +++ b/Source/cmFunctionBlocker.h @@ -17,11 +17,6 @@ #include "cmListFileCache.h" class cmMakefile; -/** \class cmFunctionBlocker - * \brief A class that defines an interface for blocking cmake functions - * - * This is the superclass for any classes that need to block a cmake function - */ class cmFunctionBlocker { public: diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 7a80a1c..ce36145 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -28,7 +28,7 @@ public: * cmMacroHelperCommand and cmFunctionHelperCommand * which cannot provide appropriate documentation. */ - virtual bool ShouldAppearInDocumentation() + virtual bool ShouldAppearInDocumentation() const { return false; } @@ -49,7 +49,7 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * This is called when the command is first encountered in @@ -64,12 +64,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return this->Args[0].c_str(); } + virtual const char* GetName() const { return this->Args[0].c_str(); } /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { std::string docs = "Function named: "; docs += this->GetName(); @@ -79,7 +79,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return this->GetTerseDocumentation(); } diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index a169244..43c8e29 100644 --- a/Source/cmFunctionCommand.h +++ b/Source/cmFunctionCommand.h @@ -15,11 +15,6 @@ #include "cmCommand.h" #include "cmFunctionBlocker.h" -/** \class cmFunctionFunctionBlocker - * \brief subclass of function blocker - * - * - */ class cmFunctionFunctionBlocker : public cmFunctionBlocker { public: @@ -35,11 +30,7 @@ public: int Depth; }; -/** \class cmFunctionCommand - * \brief starts an if block - * - * cmFunctionCommand starts an if block - */ +/// Starts function() ... endfunction() block class cmFunctionCommand : public cmCommand { public: @@ -61,17 +52,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "function";} + virtual const char* GetName() const { return "function";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Start recording a function for later invocation as a command."; } @@ -79,7 +70,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " function(<name> [arg1 [arg2 [arg3 ...]]])\n" diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx new file mode 100644 index 0000000..369eb5c --- /dev/null +++ b/Source/cmGeneratorTarget.cxx @@ -0,0 +1,95 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 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. +============================================================================*/ +#include "cmGeneratorTarget.h" + +#include "cmTarget.h" +#include "cmMakefile.h" +#include "cmLocalGenerator.h" +#include "cmGlobalGenerator.h" +#include "cmSourceFile.h" + +//---------------------------------------------------------------------------- +cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) +{ + this->Makefile = this->Target->GetMakefile(); + this->LocalGenerator = this->Makefile->GetLocalGenerator(); + this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); + this->ClassifySources(); +} + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::ClassifySources() +{ + bool isObjLib = this->Target->GetType() == cmTarget::OBJECT_LIBRARY; + std::vector<cmSourceFile*> badObjLib; + std::vector<cmSourceFile*> const& sources = this->Target->GetSourceFiles(); + for(std::vector<cmSourceFile*>::const_iterator si = sources.begin(); + si != sources.end(); ++si) + { + cmSourceFile* sf = *si; + cmTarget::SourceFileFlags tsFlags = + this->Target->GetTargetSourceFileFlags(sf); + if(sf->GetCustomCommand()) + { + this->CustomCommands.push_back(sf); + } + else if(tsFlags.Type != cmTarget::SourceFileTypeNormal) + { + this->OSXContent.push_back(sf); + if(isObjLib) { badObjLib.push_back(sf); } + } + else if(sf->GetPropertyAsBool("HEADER_FILE_ONLY")) + { + this->HeaderSources.push_back(sf); + } + else if(sf->GetPropertyAsBool("EXTERNAL_OBJECT")) + { + this->ExternalObjects.push_back(sf); + if(isObjLib) { badObjLib.push_back(sf); } + } + else if(cmSystemTools::LowerCase(sf->GetExtension()) == "def") + { + this->ModuleDefinitionFile = sf->GetFullPath(); + if(isObjLib) { badObjLib.push_back(sf); } + } + else if(this->GlobalGenerator->IgnoreFile(sf->GetExtension().c_str())) + { + // We only get here if a source file is not an external object + // and has an extension that is listed as an ignored file type. + // No message or diagnosis should be given. + } + else if(sf->GetLanguage()) + { + this->ObjectSources.push_back(sf); + } + else + { + this->ExtraSources.push_back(sf); + if(isObjLib) { badObjLib.push_back(sf); } + } + } + + if(!badObjLib.empty()) + { + cmOStringStream e; + e << "OBJECT library \"" << this->Target->GetName() << "\" contains:\n"; + for(std::vector<cmSourceFile*>::iterator i = badObjLib.begin(); + i != badObjLib.end(); ++i) + { + e << " " << (*i)->GetLocation().GetName() << "\n"; + } + e << "but may contain only headers and sources that compile."; + this->GlobalGenerator->GetCMakeInstance() + ->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->Target->GetBacktrace()); + } +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h new file mode 100644 index 0000000..b083ba1 --- /dev/null +++ b/Source/cmGeneratorTarget.h @@ -0,0 +1,58 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 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 cmGeneratorTarget_h +#define cmGeneratorTarget_h + +#include "cmStandardIncludes.h" + +class cmCustomCommand; +class cmGlobalGenerator; +class cmLocalGenerator; +class cmMakefile; +class cmSourceFile; +class cmTarget; + +class cmGeneratorTarget +{ +public: + cmGeneratorTarget(cmTarget*); + + cmTarget* Target; + cmMakefile* Makefile; + cmLocalGenerator* LocalGenerator; + cmGlobalGenerator* GlobalGenerator; + + /** Sources classified by purpose. */ + std::vector<cmSourceFile*> CustomCommands; + std::vector<cmSourceFile*> ExtraSources; + std::vector<cmSourceFile*> HeaderSources; + std::vector<cmSourceFile*> ObjectSources; + std::vector<cmSourceFile*> ExternalObjects; + std::vector<cmSourceFile*> OSXContent; + std::string ModuleDefinitionFile; + + std::map<cmSourceFile const*, std::string> Objects; + std::set<cmSourceFile const*> ExplicitObjectName; + + /** Full path with trailing slash to the top-level directory + holding object files for this target. Includes the build + time config name placeholder if needed for the generator. */ + std::string ObjectDirectory; + +private: + void ClassifySources(); + + cmGeneratorTarget(cmGeneratorTarget const&); + void operator=(cmGeneratorTarget const&); +}; + +#endif diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h index d82be70..0a5917c 100644 --- a/Source/cmGetCMakePropertyCommand.h +++ b/Source/cmGetCMakePropertyCommand.h @@ -32,17 +32,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "get_cmake_property";} + virtual const char* GetName() const { return "get_cmake_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get a property of the CMake instance."; } @@ -50,7 +50,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " get_cmake_property(VAR property)\n" diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h index b7a5f71..901b90c 100644 --- a/Source/cmGetDirectoryPropertyCommand.h +++ b/Source/cmGetDirectoryPropertyCommand.h @@ -32,17 +32,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "get_directory_property";} + virtual const char* GetName() const { return "get_directory_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get a property of DIRECTORY scope."; } @@ -50,7 +50,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " get_directory_property(<variable> [DIRECTORY <dir>] <prop-name>)\n" diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h index aff4d7e..0c8e57a 100644 --- a/Source/cmGetFilenameComponentCommand.h +++ b/Source/cmGetFilenameComponentCommand.h @@ -41,17 +41,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "get_filename_component";} + virtual const char* GetName() const { return "get_filename_component";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get a specific component of a full filename."; } @@ -59,7 +59,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " get_filename_component(<VAR> FileName\n" diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h index d318b19..dca2627 100644 --- a/Source/cmGetPropertyCommand.h +++ b/Source/cmGetPropertyCommand.h @@ -34,17 +34,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "get_property";} + virtual const char* GetName() const { return "get_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get a property."; } @@ -52,7 +52,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " get_property(<variable>\n" diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h index 56469f8..6d52503 100644 --- a/Source/cmGetSourceFilePropertyCommand.h +++ b/Source/cmGetSourceFilePropertyCommand.h @@ -32,12 +32,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "get_source_file_property";} + virtual const char* GetName() const { return "get_source_file_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get a property for a source file."; } @@ -45,7 +45,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " get_source_file_property(VAR file property)\n" diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h index 71c75ef..b60abea 100644 --- a/Source/cmGetTargetPropertyCommand.h +++ b/Source/cmGetTargetPropertyCommand.h @@ -32,12 +32,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "get_target_property";} + virtual const char* GetName() const { return "get_target_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get a property from a target."; } @@ -45,7 +45,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " get_target_property(VAR target property)\n" diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h index d9f5d9b..af6bafa 100644 --- a/Source/cmGetTestPropertyCommand.h +++ b/Source/cmGetTestPropertyCommand.h @@ -32,12 +32,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "get_test_property";} + virtual const char* GetName() const { return "get_test_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get a property of the test."; } @@ -45,7 +45,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " get_test_property(test property VAR)\n" diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a988844..545f9e8 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -24,6 +24,7 @@ #include "cmExportInstallFileGenerator.h" #include "cmComputeTargetDepends.h" #include "cmGeneratedFileStream.h" +#include "cmGeneratorTarget.h" #include <cmsys/Directory.hxx> @@ -74,6 +75,7 @@ cmGlobalGenerator::~cmGlobalGenerator() delete this->ExtraGenerator; } + this->ClearGeneratorTargets(); this->ClearExportSets(); } @@ -807,6 +809,7 @@ bool cmGlobalGenerator::IsDependedOn(const char* project, void cmGlobalGenerator::Configure() { this->FirstTimeProgress = 0.0f; + this->ClearGeneratorTargets(); this->ClearExportSets(); // Delete any existing cmLocalGenerators unsigned int i; @@ -947,6 +950,9 @@ void cmGlobalGenerator::Generate() this->LocalGenerators[i]->GenerateTargetManifest(); } + // Create per-target generator information. + this->CreateGeneratorTargets(); + // Compute the inter-target dependencies. if(!this->ComputeTargetDepends()) { @@ -1056,6 +1062,55 @@ void cmGlobalGenerator::CreateAutomocTargets() #endif } +//---------------------------------------------------------------------------- +void cmGlobalGenerator::CreateGeneratorTargets() +{ + // Construct per-target generator information. + for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) + { + cmTargets& targets = + this->LocalGenerators[i]->GetMakefile()->GetTargets(); + for(cmTargets::iterator ti = targets.begin(); + ti != targets.end(); ++ti) + { + cmTarget* t = &ti->second; + cmGeneratorTarget* gt = new cmGeneratorTarget(t); + this->GeneratorTargets[t] = gt; + this->ComputeTargetObjects(gt); + } + } +} + +//---------------------------------------------------------------------------- +void cmGlobalGenerator::ClearGeneratorTargets() +{ + for(GeneratorTargetsType::iterator i = this->GeneratorTargets.begin(); + i != this->GeneratorTargets.end(); ++i) + { + delete i->second; + } + this->GeneratorTargets.clear(); +} + +//---------------------------------------------------------------------------- +cmGeneratorTarget* cmGlobalGenerator::GetGeneratorTarget(cmTarget* t) const +{ + GeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t); + if(ti == this->GeneratorTargets.end()) + { + this->CMakeInstance->IssueMessage( + cmake::INTERNAL_ERROR, "Missing cmGeneratorTarget instance!", + cmListFileBacktrace()); + return 0; + } + return ti->second; +} + +//---------------------------------------------------------------------------- +void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget*) const +{ + // Implemented in generator subclasses that need this. +} void cmGlobalGenerator::CheckLocalGenerators() { @@ -1714,7 +1769,7 @@ void cmGlobalGenerator::SetCMakeInstance(cmake* cm) void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) { cmMakefile* mf = this->LocalGenerators[0]->GetMakefile(); - const char* cmakeCfgIntDir = this->GetCMakeCFGInitDirectory(); + const char* cmakeCfgIntDir = this->GetCMakeCFGIntDir(); const char* cmakeCommand = mf->GetRequiredDefinition("CMAKE_COMMAND"); // CPack diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 1a0e41a..80b948b 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -19,6 +19,7 @@ #include "cmTargetDepend.h" // For cmTargetDependSet #include "cmSystemTools.h" // for cmSystemTools::OutputOption class cmake; +class cmGeneratorTarget; class cmMakefile; class cmLocalGenerator; class cmExternalMakefileProjectGenerator; @@ -183,7 +184,7 @@ public: const char* GetLanguageOutputExtension(cmSourceFile const&); ///! What is the configurations directory variable called? - virtual const char* GetCMakeCFGInitDirectory() { return "."; } + virtual const char* GetCMakeCFGIntDir() const { return "."; } /** Get whether the generator should use a script for link commands. */ bool GetUseLinkScript() const { return this->UseLinkScript; } @@ -251,6 +252,9 @@ public: // via a target_link_libraries or add_dependencies TargetDependSet const& GetTargetDirectDepends(cmTarget & target); + /** Get per-target generator information. */ + cmGeneratorTarget* GetGeneratorTarget(cmTarget*) const; + const std::map<cmStdString, std::vector<cmLocalGenerator*> >& GetProjectMap() const {return this->ProjectMap;} @@ -370,6 +374,13 @@ private: typedef std::map<cmTarget *, TargetDependSet> TargetDependMap; TargetDependMap TargetDependencies; + // Per-target generator information. + typedef std::map<cmTarget*, cmGeneratorTarget*> GeneratorTargetsType; + GeneratorTargetsType GeneratorTargets; + void CreateGeneratorTargets(); + void ClearGeneratorTargets(); + virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; + // Cache directory content and target files to be built. struct DirectoryContent: public std::set<cmStdString> { diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index a23c0d8..e63de9c 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -17,6 +17,7 @@ #include "cmGeneratedFileStream.h" #include "cmSourceFile.h" #include "cmTarget.h" +#include "cmGeneratorTarget.h" cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3() { @@ -71,6 +72,38 @@ void cmGlobalUnixMakefileGenerator3 } //---------------------------------------------------------------------------- +void +cmGlobalUnixMakefileGenerator3 +::ComputeTargetObjects(cmGeneratorTarget* gt) const +{ + cmTarget* target = gt->Target; + cmLocalUnixMakefileGenerator3* lg = + static_cast<cmLocalUnixMakefileGenerator3*>(gt->LocalGenerator); + + // Compute full path to object file directory for this target. + std::string dir_max; + dir_max += gt->Makefile->GetCurrentOutputDirectory(); + dir_max += "/"; + dir_max += gt->LocalGenerator->GetTargetDirectory(*target); + dir_max += "/"; + gt->ObjectDirectory = dir_max; + + // Compute the name of each object file. + for(std::vector<cmSourceFile*>::iterator + si = gt->ObjectSources.begin(); + si != gt->ObjectSources.end(); ++si) + { + cmSourceFile* sf = *si; + bool hasSourceExtension = true; + std::string objectName = gt->LocalGenerator + ->GetObjectFileNameWithoutTarget(*sf, dir_max, + &hasSourceExtension); + gt->Objects[sf] = objectName; + lg->AddLocalObjectFile(target, sf, objectName, hasSourceExtension); + } +} + +//---------------------------------------------------------------------------- std::string EscapeJSON(const std::string& s) { std::string result; for (std::string::size_type i = 0; i < s.size(); ++i) { @@ -378,6 +411,7 @@ void cmGlobalUnixMakefileGenerator3 (l->second.GetType() == cmTarget::STATIC_LIBRARY) || (l->second.GetType() == cmTarget::SHARED_LIBRARY) || (l->second.GetType() == cmTarget::MODULE_LIBRARY) || + (l->second.GetType() == cmTarget::OBJECT_LIBRARY) || (l->second.GetType() == cmTarget::UTILITY)) { std::string tname = lg->GetRelativeTargetDirectory(l->second); @@ -413,6 +447,7 @@ cmGlobalUnixMakefileGenerator3 (l->second.GetType() == cmTarget::STATIC_LIBRARY) || (l->second.GetType() == cmTarget::SHARED_LIBRARY) || (l->second.GetType() == cmTarget::MODULE_LIBRARY) || + (l->second.GetType() == cmTarget::OBJECT_LIBRARY) || (l->second.GetType() == cmTarget::UTILITY)) { // Add this to the list of depends rules in this directory. @@ -587,6 +622,7 @@ cmGlobalUnixMakefileGenerator3 (t->second.GetType() == cmTarget::STATIC_LIBRARY) || (t->second.GetType() == cmTarget::SHARED_LIBRARY) || (t->second.GetType() == cmTarget::MODULE_LIBRARY) || + (t->second.GetType() == cmTarget::OBJECT_LIBRARY) || (t->second.GetType() == cmTarget::UTILITY))) { // Add a rule to build the target by name. @@ -673,6 +709,7 @@ cmGlobalUnixMakefileGenerator3 || (t->second.GetType() == cmTarget::STATIC_LIBRARY) || (t->second.GetType() == cmTarget::SHARED_LIBRARY) || (t->second.GetType() == cmTarget::MODULE_LIBRARY) + || (t->second.GetType() == cmTarget::OBJECT_LIBRARY) || (t->second.GetType() == cmTarget::UTILITY))) { std::string makefileName; @@ -982,6 +1019,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule (t->second.GetType() == cmTarget::STATIC_LIBRARY) || (t->second.GetType() == cmTarget::SHARED_LIBRARY) || (t->second.GetType() == cmTarget::MODULE_LIBRARY) || + (t->second.GetType() == cmTarget::OBJECT_LIBRARY) || (t->second.GetType() == cmTarget::GLOBAL_TARGET) || (t->second.GetType() == cmTarget::UTILITY)) { diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 9663b55..e6dd09d 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -182,6 +182,8 @@ protected: size_t CountProgressMarksInAll(cmLocalUnixMakefileGenerator3* lg); cmGeneratedFileStream *CommandDatabase; +private: + virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; }; #endif diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 18b483d..750b89c 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -72,7 +72,7 @@ public: * Studio? */ virtual std::string GetUserMacrosRegKeyBase(); - virtual const char* GetCMakeCFGInitDirectory() + virtual const char* GetCMakeCFGIntDir() const { return "$(Configuration)";} bool Find64BitTools(cmMakefile* mf); protected: diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 77d5370..da08a12 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -82,7 +82,7 @@ public: std::string& dir); ///! What is the configurations directory variable called? - virtual const char* GetCMakeCFGInitDirectory() { return "$(IntDir)"; } + virtual const char* GetCMakeCFGIntDir() const { return "$(IntDir)"; } protected: virtual const char* GetIDEVersion() { return "6.0"; } diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index adfb757..c92998e 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -87,7 +87,7 @@ public: std::string& dir); ///! What is the configurations directory variable called? - virtual const char* GetCMakeCFGInitDirectory() { return "$(OutDir)"; } + virtual const char* GetCMakeCFGIntDir() const { return "$(OutDir)"; } /** Return true if the target project file should have the option LinkLibraryDependencies and link to .sln dependencies. */ diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 449d090..7da4f86 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -12,8 +12,10 @@ #include "cmGlobalVisualStudioGenerator.h" #include "cmCallVisualStudioMacro.h" -#include "cmLocalGenerator.h" +#include "cmGeneratorTarget.h" +#include "cmLocalVisualStudioGenerator.h" #include "cmMakefile.h" +#include "cmSourceFile.h" #include "cmTarget.h" //---------------------------------------------------------------------------- @@ -98,6 +100,64 @@ void cmGlobalVisualStudioGenerator::Generate() } //---------------------------------------------------------------------------- +void +cmGlobalVisualStudioGenerator +::ComputeTargetObjects(cmGeneratorTarget* gt) const +{ + cmLocalVisualStudioGenerator* lg = + static_cast<cmLocalVisualStudioGenerator*>(gt->LocalGenerator); + std::string dir_max = lg->ComputeLongestObjectDirectory(*gt->Target); + + // Count the number of object files with each name. Note that + // windows file names are not case sensitive. + std::map<cmStdString, int> counts; + for(std::vector<cmSourceFile*>::const_iterator + si = gt->ObjectSources.begin(); + si != gt->ObjectSources.end(); ++si) + { + cmSourceFile* sf = *si; + std::string objectNameLower = cmSystemTools::LowerCase( + cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); + objectNameLower += ".obj"; + counts[objectNameLower] += 1; + } + + // For all source files producing duplicate names we need unique + // object name computation. + for(std::vector<cmSourceFile*>::const_iterator + si = gt->ObjectSources.begin(); + si != gt->ObjectSources.end(); ++si) + { + cmSourceFile* sf = *si; + std::string objectName = + cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()); + objectName += ".obj"; + if(counts[cmSystemTools::LowerCase(objectName)] > 1) + { + gt->ExplicitObjectName.insert(sf); + objectName = lg->GetObjectFileNameWithoutTarget(*sf, dir_max); + } + gt->Objects[sf] = objectName; + } + + std::string dir = gt->Makefile->GetCurrentOutputDirectory(); + dir += "/"; + std::string tgtDir = lg->GetTargetDirectory(*gt->Target); + if(!tgtDir.empty()) + { + dir += tgtDir; + dir += "/"; + } + const char* cd = this->GetCMakeCFGIntDir(); + if(cd && *cd) + { + dir += cd; + dir += "/"; + } + gt->ObjectDirectory = dir; +} + +//---------------------------------------------------------------------------- bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile, const std::string& regKeyBase, std::string& nextAvailableSubKeyName); @@ -315,6 +375,12 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends() } //---------------------------------------------------------------------------- +static bool VSLinkable(cmTarget* t) +{ + return t->IsLinkable() || t->GetType() == cmTarget::OBJECT_LIBRARY; +} + +//---------------------------------------------------------------------------- void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) { if(this->VSTargetDepends.find(&target) != this->VSTargetDepends.end()) @@ -398,7 +464,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) di != utilDepends.end(); ++di) { cmTarget* dep = *di; - if(allowLinkable || !dep->IsLinkable() || linked.count(dep)) + if(allowLinkable || !VSLinkable(dep) || linked.count(dep)) { // Direct dependency allowed. vsTargetDepend.insert(dep->GetName()); diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index bc96f4e..b62ba22 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -97,6 +97,8 @@ protected: typedef std::map<cmTarget*, cmStdString> UtilityDependsMap; UtilityDependsMap UtilityDepends; private: + void ComputeTargetObjects(cmGeneratorTarget* gt) const; + void FollowLinkDepends(cmTarget* target, std::set<cmTarget*>& linked); class TargetSetMap: public std::map<cmTarget*, TargetSet> {}; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index cb74746..a6a9200 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -179,8 +179,6 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const& mf->AddDefinition("CMAKE_GENERATOR_CC", "gcc"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "g++"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); - // initialize Architectures so it can be used by - // GetTargetObjectFileDirectories this->cmGlobalGenerator::EnableLanguage(lang, mf, optional); const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES"); @@ -3285,7 +3283,7 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, } //---------------------------------------------------------------------------- -const char* cmGlobalXCodeGenerator::GetCMakeCFGInitDirectory() +const char* cmGlobalXCodeGenerator::GetCMakeCFGIntDir() const { return this->XcodeVersion >= 21 ? "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)" : "."; @@ -3363,37 +3361,6 @@ std::string cmGlobalXCodeGenerator::XCodeEscapePath(const char* p) } //---------------------------------------------------------------------------- -void cmGlobalXCodeGenerator:: -GetTargetObjectFileDirectories(cmTarget* target, - std::vector<std::string>& - dirs) -{ - std::string dir = this->CurrentMakefile->GetCurrentOutputDirectory(); - dir += "/"; - dir += this->CurrentMakefile->GetProjectName(); - dir += ".build/"; - dir += this->GetCMakeCFGInitDirectory(); - dir += "/"; - dir += target->GetName(); - dir += ".build/Objects-normal/"; - std::string dirsave = dir; - if(this->Architectures.size()) - { - for(std::vector<std::string>::iterator i = this->Architectures.begin(); - i != this->Architectures.end(); ++i) - { - dir += *i; - dirs.push_back(dir); - dir = dirsave; - } - } - else - { - dirs.push_back(dir); - } -} - -//---------------------------------------------------------------------------- void cmGlobalXCodeGenerator ::AppendDirectoryForConfig(const char* prefix, diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index ed54be3..b9cf775 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -74,11 +74,8 @@ public: std::string& dir); ///! What is the configurations directory variable called? - virtual const char* GetCMakeCFGInitDirectory(); + virtual const char* GetCMakeCFGIntDir() const; - void GetTargetObjectFileDirectories(cmTarget* target, - std::vector<std::string>& - dirs); void SetCurrentLocalGenerator(cmLocalGenerator*); /** Return true if the generated build tree may contain multiple builds. diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 4996bc4..83ea8a4 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -15,11 +15,6 @@ #include "cmCommand.h" #include "cmFunctionBlocker.h" -/** \class cmIfFunctionBlocker - * \brief subclass of function blocker - * - * - */ class cmIfFunctionBlocker : public cmFunctionBlocker { public: @@ -39,11 +34,7 @@ public: unsigned int ScopeDepth; }; -/** \class cmIfCommand - * \brief starts an if block - * - * cmIfCommand starts an if block - */ +/// Starts an if block class cmIfCommand : public cmCommand { public: @@ -72,12 +63,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "if";} + virtual const char* GetName() const { return "if";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Conditionally execute a group of commands."; } @@ -85,12 +76,12 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " if(expression)\n" diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h index d933ef3..c46c02d 100644 --- a/Source/cmIncludeCommand.h +++ b/Source/cmIncludeCommand.h @@ -43,17 +43,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "include";} + virtual const char* GetName() const {return "include";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Read CMake listfile code from the given file."; } @@ -61,7 +61,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " include(<file|module> [OPTIONAL] [RESULT_VARIABLE <VAR>]\n" diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h index cbe344f..dcc116a 100644 --- a/Source/cmIncludeDirectoryCommand.h +++ b/Source/cmIncludeDirectoryCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "include_directories";} + virtual const char* GetName() const { return "include_directories";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add include directories to the build."; } @@ -54,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " include_directories([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...)\n" diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h index 5269041..911a772 100644 --- a/Source/cmIncludeExternalMSProjectCommand.h +++ b/Source/cmIncludeExternalMSProjectCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "include_external_msproject";} + virtual const char* GetName() const {return "include_external_msproject";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Include an external Microsoft project file in a workspace."; } @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " include_external_msproject(projectname location\n" diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h index 6ddbbed..7c633c0 100644 --- a/Source/cmIncludeRegularExpressionCommand.h +++ b/Source/cmIncludeRegularExpressionCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "include_regular_expression";} + virtual const char* GetName() const {return "include_regular_expression";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Set the regular expression used for dependency checking."; } @@ -54,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " include_regular_expression(regex_match [regex_complain])\n" diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index dca528d..c656487 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -357,7 +357,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) if(target->GetType() != cmTarget::EXECUTABLE && target->GetType() != cmTarget::STATIC_LIBRARY && target->GetType() != cmTarget::SHARED_LIBRARY && - target->GetType() != cmTarget::MODULE_LIBRARY) + target->GetType() != cmTarget::MODULE_LIBRARY && + target->GetType() != cmTarget::OBJECT_LIBRARY) { cmOStringStream e; e << "TARGETS given target \"" << (*targetIt) @@ -365,6 +366,14 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) this->SetError(e.str().c_str()); return false; } + else if(target->GetType() == cmTarget::OBJECT_LIBRARY) + { + cmOStringStream e; + e << "TARGETS given OBJECT library \"" << (*targetIt) + << "\" which may not be installed."; + this->SetError(e.str().c_str()); + return false; + } // Store the target in the list to be installed. targets.push_back(target); } diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 377b43a..3403c38 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "install";} + virtual const char* GetName() const { return "install";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Specify rules to run at install time."; } @@ -54,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "This command generates installation rules for a project. " diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index ab32f94..ddf7d08 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -42,7 +42,7 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, { // Write code to install the directories. const char* no_rename = 0; - this->AddInstallRule(os, cmTarget::INSTALL_DIRECTORY, + this->AddInstallRule(os, cmInstallType_DIRECTORY, this->Directories, this->Optional, this->FilePermissions.c_str(), diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 69e3f2c..28a19d7 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -16,7 +16,6 @@ #include "cmake.h" #include "cmInstallTargetGenerator.h" #include "cmGeneratedFileStream.h" -#include "cmTarget.h" #include "cmMakefile.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" @@ -186,7 +185,7 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os, files.push_back(i->second); std::string config_test = this->CreateConfigTest(i->first.c_str()); os << indent << "IF(" << config_test << ")\n"; - this->AddInstallRule(os, cmTarget::INSTALL_FILES, files, false, + this->AddInstallRule(os, cmInstallType_FILES, files, false, this->FilePermissions.c_str(), 0, 0, 0, indent.Next()); os << indent << "ENDIF(" << config_test << ")\n"; @@ -225,6 +224,6 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os, // Install the main export file. std::vector<std::string> files; files.push_back(this->MainImportFile); - this->AddInstallRule(os, cmTarget::INSTALL_FILES, files, false, + this->AddInstallRule(os, cmInstallType_FILES, files, false, this->FilePermissions.c_str(), 0, 0, 0, indent); } diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h index da43920..d3c7ed6 100644 --- a/Source/cmInstallFilesCommand.h +++ b/Source/cmInstallFilesCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "install_files";} + virtual const char* GetName() const { return "install_files";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the install(FILES ) command instead."; } @@ -63,7 +63,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "This command has been superceded by the install command. It " @@ -92,7 +92,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 28f055f..ec02bc7 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -11,8 +11,6 @@ ============================================================================*/ #include "cmInstallFilesGenerator.h" -#include "cmTarget.h" - //---------------------------------------------------------------------------- cmInstallFilesGenerator ::cmInstallFilesGenerator(std::vector<std::string> const& files, @@ -43,8 +41,8 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os, const char* no_dir_permissions = 0; this->AddInstallRule(os, (this->Programs - ? cmTarget::INSTALL_PROGRAMS - : cmTarget::INSTALL_FILES), + ? cmInstallType_PROGRAMS + : cmInstallType_FILES), this->Files, this->Optional, this->FilePermissions.c_str(), no_dir_permissions, diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index d7505dc..807168e 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -12,7 +12,6 @@ #include "cmInstallGenerator.h" #include "cmSystemTools.h" -#include "cmTarget.h" //---------------------------------------------------------------------------- cmInstallGenerator @@ -35,7 +34,7 @@ cmInstallGenerator void cmInstallGenerator ::AddInstallRule( std::ostream& os, - int type, + cmInstallType type, std::vector<std::string> const& files, bool optional /* = false */, const char* permissions_file /* = 0 */, @@ -49,14 +48,13 @@ void cmInstallGenerator std::string stype; switch(type) { - case cmTarget::INSTALL_DIRECTORY:stype = "DIRECTORY"; break; - case cmTarget::INSTALL_PROGRAMS: stype = "PROGRAM"; break; - case cmTarget::EXECUTABLE: stype = "EXECUTABLE"; break; - case cmTarget::STATIC_LIBRARY: stype = "STATIC_LIBRARY"; break; - case cmTarget::SHARED_LIBRARY: stype = "SHARED_LIBRARY"; break; - case cmTarget::MODULE_LIBRARY: stype = "MODULE"; break; - case cmTarget::INSTALL_FILES: - default: stype = "FILE"; break; + case cmInstallType_DIRECTORY: stype = "DIRECTORY"; break; + case cmInstallType_PROGRAMS: stype = "PROGRAM"; break; + case cmInstallType_EXECUTABLE: stype = "EXECUTABLE"; break; + case cmInstallType_STATIC_LIBRARY: stype = "STATIC_LIBRARY"; break; + case cmInstallType_SHARED_LIBRARY: stype = "SHARED_LIBRARY"; break; + case cmInstallType_MODULE_LIBRARY: stype = "MODULE"; break; + case cmInstallType_FILES: stype = "FILE"; break; } os << indent; std::string dest = this->GetInstallDestination(); diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index aa9a47c..c89ab8a 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -12,6 +12,7 @@ #ifndef cmInstallGenerator_h #define cmInstallGenerator_h +#include "cmInstallType.h" #include "cmScriptGenerator.h" class cmLocalGenerator; @@ -29,7 +30,7 @@ public: virtual ~cmInstallGenerator(); void AddInstallRule( - std::ostream& os, int type, + std::ostream& os, cmInstallType type, std::vector<std::string> const& files, bool optional = false, const char* permissions_file = 0, diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h index 1d0d25e..29c84a0 100644 --- a/Source/cmInstallProgramsCommand.h +++ b/Source/cmInstallProgramsCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "install_programs";} + virtual const char* GetName() const { return "install_programs";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the install(PROGRAMS ) command instead."; } @@ -64,7 +64,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "This command has been superceded by the install command. It " @@ -89,7 +89,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index ac1c949..5f9b658 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -82,8 +82,23 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, std::vector<std::string> filesFrom; std::vector<std::string> filesTo; std::string literal_args; - cmTarget::TargetType type = this->Target->GetType(); - if(type == cmTarget::EXECUTABLE) + cmTarget::TargetType targetType = this->Target->GetType(); + cmInstallType type = cmInstallType(); + switch(targetType) + { + case cmTarget::EXECUTABLE: type = cmInstallType_EXECUTABLE; break; + case cmTarget::STATIC_LIBRARY: type = cmInstallType_STATIC_LIBRARY; break; + case cmTarget::SHARED_LIBRARY: type = cmInstallType_SHARED_LIBRARY; break; + case cmTarget::MODULE_LIBRARY: type = cmInstallType_MODULE_LIBRARY; break; + case cmTarget::OBJECT_LIBRARY: + case cmTarget::UTILITY: + case cmTarget::GLOBAL_TARGET: + case cmTarget::UNKNOWN_LIBRARY: + this->Target->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, + "cmInstallTargetGenerator created with non-installable target."); + return; + } + if(targetType == cmTarget::EXECUTABLE) { // There is a bug in cmInstallCommand if this fails. assert(this->NamelinkMode == NamelinkModeNone); @@ -110,7 +125,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, } // An import library looks like a static library. - type = cmTarget::STATIC_LIBRARY; + type = cmInstallType_STATIC_LIBRARY; } else { @@ -121,7 +136,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, if(this->Target->IsAppBundleOnApple()) { // Install the whole app bundle directory. - type = cmTarget::INSTALL_DIRECTORY; + type = cmInstallType_DIRECTORY; literal_args += " USE_SOURCE_PERMISSIONS"; from1 += ".app"; @@ -173,7 +188,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, } // An import library looks like a static library. - type = cmTarget::STATIC_LIBRARY; + type = cmInstallType_STATIC_LIBRARY; } else if(this->Target->IsFrameworkOnApple()) { @@ -181,7 +196,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, assert(this->NamelinkMode == NamelinkModeNone); // Install the whole framework directory. - type = cmTarget::INSTALL_DIRECTORY; + type = cmInstallType_DIRECTORY; literal_args += " USE_SOURCE_PERMISSIONS"; std::string from1 = fromDirConfig + targetName + ".framework"; diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h index 32641f8..e05462f 100644 --- a/Source/cmInstallTargetsCommand.h +++ b/Source/cmInstallTargetsCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "install_targets";} + virtual const char* GetName() const { return "install_targets";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the install(TARGETS ) command instead."; } @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "This command has been superceded by the install command. It " @@ -69,7 +69,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmInstallType.h b/Source/cmInstallType.h new file mode 100644 index 0000000..a837368 --- /dev/null +++ b/Source/cmInstallType.h @@ -0,0 +1,29 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 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 cmInstallType_h +#define cmInstallType_h + +/** + * Enumerate types known to file(INSTALL). + */ +enum cmInstallType +{ + cmInstallType_EXECUTABLE, + cmInstallType_STATIC_LIBRARY, + cmInstallType_SHARED_LIBRARY, + cmInstallType_MODULE_LIBRARY, + cmInstallType_FILES, + cmInstallType_PROGRAMS, + cmInstallType_DIRECTORY +}; + +#endif diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h index aa13589..a7cd583 100644 --- a/Source/cmLinkDirectoriesCommand.h +++ b/Source/cmLinkDirectoriesCommand.h @@ -43,12 +43,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "link_directories";} + virtual const char* GetName() const { return "link_directories";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Specify directories in which the linker will look for libraries."; } @@ -56,7 +56,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " link_directories(directory1 directory2 ...)\n" diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h index e435126..2c0212c 100644 --- a/Source/cmLinkLibrariesCommand.h +++ b/Source/cmLinkLibrariesCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "link_libraries";} + virtual const char* GetName() const { return "link_libraries";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the target_link_libraries() command instead."; } @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "Link libraries to all targets added later.\n" @@ -70,7 +70,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index d215295..f20aa8a 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -39,17 +39,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "list";} + virtual const char* GetName() const { return "list";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "List operations."; } @@ -57,7 +57,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " list(LENGTH <list> <output variable>)\n" diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h index 8ecee4a..ac50f8d 100644 --- a/Source/cmLoadCacheCommand.h +++ b/Source/cmLoadCacheCommand.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "load_cache";} + virtual const char* GetName() const { return "load_cache";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Load in the values from another project's CMake cache."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " load_cache(pathToCacheFile READ_WITH_PREFIX\n" diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 98de411..3a0115c 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -69,12 +69,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return info.Name; } + virtual const char* GetName() const { return info.Name; } /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { if (this->info.GetTerseDocumentation) { @@ -123,7 +123,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { if (this->info.GetFullDocumentation) { diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h index db18428..6517019 100644 --- a/Source/cmLoadCommandCommand.h +++ b/Source/cmLoadCommandCommand.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "load_command";} + virtual const char* GetName() const {return "load_command";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Load a command into a running CMake."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " load_command(COMMAND_NAME <loc1> [loc2 ...])\n" diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 3920b89..13ede5d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1912,24 +1912,17 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, case cmTarget::SHARED_LIBRARY: case cmTarget::MODULE_LIBRARY: case cmTarget::UNKNOWN_LIBRARY: - { - // Get the location of the target's output file and depend on it. - if(const char* location = target->GetLocation(config)) - { - dep = location; - return true; - } - } - break; + dep = target->GetLocation(config); + return true; + case cmTarget::OBJECT_LIBRARY: + // An object library has no single file on which to depend. + // This was listed to get the target-level dependency. + return false; case cmTarget::UTILITY: case cmTarget::GLOBAL_TARGET: // A utility target has no file on which to depend. This was listed // only to get the target-level dependency. return false; - case cmTarget::INSTALL_FILES: - case cmTarget::INSTALL_PROGRAMS: - case cmTarget::INSTALL_DIRECTORY: - break; } } @@ -2984,17 +2977,6 @@ cmLocalGenerator::GetTargetDirectory(cmTarget const&) const return ""; } - -//---------------------------------------------------------------------------- -void -cmLocalGenerator::GetTargetObjectFileDirectories(cmTarget* , - std::vector<std::string>& - ) -{ - cmSystemTools::Error("GetTargetObjectFileDirectories" - " called on cmLocalGenerator"); -} - //---------------------------------------------------------------------------- unsigned int cmLocalGenerator::GetBackwardsCompatibility() { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 77c8862..124747b 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -160,15 +160,18 @@ public: void AppendFeatureOptions(std::string& flags, const char* lang, const char* feature); - /** Translate a dependency as given in CMake code to the name to - appear in a generated build file. If the given name is that of - a utility target, returns false. If the given name is that of - a CMake target it will be transformed to the real output - location of that target for the given configuration. If the - given name is the full path to a file it will be returned. - Otherwise the name is treated as a relative path with respect to - the source directory of this generator. This should only be - used for dependencies of custom commands. */ + /** \brief Get absolute path to dependency \a name + * + * Translate a dependency as given in CMake code to the name to + * appear in a generated build file. + * - If \a name is a utility target, returns false. + * - If \a name is a CMake target, it will be transformed to the real output + * location of that target for the given configuration. + * - If \a name is the full path to a file, it will be returned. + * - Otherwise \a name is treated as a relative path with respect to + * the source directory of this generator. This should only be + * used for dependencies of custom commands. + */ bool GetRealDependency(const char* name, const char* config, std::string& dep); @@ -258,14 +261,6 @@ public: }; FortranFormat GetFortranFormat(const char* value); - /** Return the directories into which object files will be put. - * There maybe more than one for fat binary systems like OSX. - */ - virtual void - GetTargetObjectFileDirectories(cmTarget* target, - std::vector<std::string>& - dirs); - /** * Convert the given remote path to a relative path with respect to * the given local path. The local path must be given in component diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 75226b5..a645303 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -145,6 +145,20 @@ void cmLocalUnixMakefileGenerator3::Generate() } //---------------------------------------------------------------------------- +void cmLocalUnixMakefileGenerator3::AddLocalObjectFile( + cmTarget* target, cmSourceFile* sf, std::string objNoTargetDir, + bool hasSourceExtension) +{ + if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str())) + { + objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir); + } + LocalObjectInfo& info = this->LocalObjectFiles[objNoTargetDir]; + info.HasSourceExtension = hasSourceExtension; + info.push_back(LocalObjectEntry(target, sf->GetLanguage())); +} + +//---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::GetIndividualFileTargets (std::vector<std::string>& targets) { @@ -344,6 +358,7 @@ void cmLocalUnixMakefileGenerator3 (t->second.GetType() == cmTarget::STATIC_LIBRARY) || (t->second.GetType() == cmTarget::SHARED_LIBRARY) || (t->second.GetType() == cmTarget::MODULE_LIBRARY) || + (t->second.GetType() == cmTarget::OBJECT_LIBRARY) || (t->second.GetType() == cmTarget::UTILITY)) { emitted.insert(t->second.GetName()); @@ -1995,45 +2010,6 @@ void cmLocalUnixMakefileGenerator3 } //---------------------------------------------------------------------------- -std::string -cmLocalUnixMakefileGenerator3 -::GetObjectFileName(cmTarget& target, - const cmSourceFile& source, - std::string* nameWithoutTargetDir, - bool* hasSourceExtension) -{ - // Make sure we never hit this old case. - if(source.GetProperty("MACOSX_PACKAGE_LOCATION")) - { - std::string msg = "MACOSX_PACKAGE_LOCATION set on source file: "; - msg += source.GetFullPath(); - this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, - msg.c_str()); - } - - // Start with the target directory. - std::string obj = this->GetTargetDirectory(target); - obj += "/"; - - // Get the object file name without the target directory. - std::string dir_max; - dir_max += this->Makefile->GetCurrentOutputDirectory(); - dir_max += "/"; - dir_max += obj; - std::string objectName = - this->GetObjectFileNameWithoutTarget(source, dir_max, - hasSourceExtension); - if(nameWithoutTargetDir) - { - *nameWithoutTargetDir = objectName; - } - - // Append the object name to the target directory. - obj += objectName; - return obj; -} - -//---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::WriteDisclaimer(std::ostream& os) { os @@ -2267,14 +2243,3 @@ void cmLocalUnixMakefileGenerator3 } } } - - -void cmLocalUnixMakefileGenerator3 -::GetTargetObjectFileDirectories(cmTarget* target, - std::vector<std::string>& dirs) -{ - std::string dir = this->Makefile->GetCurrentOutputDirectory(); - dir += "/"; - dir += this->GetTargetDirectory(*target); - dirs.push_back(dir); -} diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 45ac21d..e374959 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -225,24 +225,9 @@ public: // write the target rules for the local Makefile into the stream void WriteLocalAllRules(std::ostream& ruleFileStream); - struct LocalObjectEntry - { - cmTarget* Target; - std::string Language; - LocalObjectEntry(): Target(0), Language() {} - LocalObjectEntry(cmTarget* t, const char* lang): - Target(t), Language(lang) {} - }; - struct LocalObjectInfo: public std::vector<LocalObjectEntry> - { - bool HasSourceExtension; - bool HasPreprocessRule; - bool HasAssembleRule; - LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false), - HasAssembleRule(false) {} - }; - std::map<cmStdString, LocalObjectInfo> const& GetLocalObjectFiles() - { return this->LocalObjectFiles;} + void AddLocalObjectFile(cmTarget* target, cmSourceFile* sf, + std::string objNoTargetDir, + bool hasSourceExtension); std::vector<cmStdString> const& GetLocalHelp() { return this->LocalHelp; } @@ -257,9 +242,6 @@ public: { return !this->SkipAssemblySourceRules; } - // Get the directories into which the .o files will go for this target - void GetTargetObjectFileDirectories(cmTarget* target, - std::vector<std::string>& dirs); // Fill the vector with the target names for the object files, // preprocessed files and assembly files. Currently only used by the @@ -301,14 +283,6 @@ protected: void WriteTargetRequiresRule(std::ostream& ruleFileStream, cmTarget& target, const std::vector<std::string>& objects); - void WriteObjectConvenienceRule(std::ostream& ruleFileStream, - const char* comment, const char* output, - LocalObjectInfo const& info); - - std::string GetObjectFileName(cmTarget& target, - const cmSourceFile& source, - std::string* nameWithoutTargetDir = 0, - bool* hasSourceExtension = 0); void AppendRuleDepend(std::vector<std::string>& depends, const char* ruleFileName); @@ -378,7 +352,27 @@ private: bool SkipPreprocessedSourceRules; bool SkipAssemblySourceRules; + struct LocalObjectEntry + { + cmTarget* Target; + std::string Language; + LocalObjectEntry(): Target(0), Language() {} + LocalObjectEntry(cmTarget* t, const char* lang): + Target(t), Language(lang) {} + }; + struct LocalObjectInfo: public std::vector<LocalObjectEntry> + { + bool HasSourceExtension; + bool HasPreprocessRule; + bool HasAssembleRule; + LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false), + HasAssembleRule(false) {} + }; std::map<cmStdString, LocalObjectInfo> LocalObjectFiles; + void WriteObjectConvenienceRule(std::ostream& ruleFileStream, + const char* comment, const char* output, + LocalObjectInfo const& info); + std::vector<cmStdString> LocalHelp; /* does the work for each target */ diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index c846d6b..f53ad0e 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -15,6 +15,7 @@ #include "cmSystemTools.h" #include "cmSourceFile.h" #include "cmCacheManager.h" +#include "cmGeneratorTarget.h" #include "cmake.h" #include "cmComputeLinkInformation.h" @@ -126,6 +127,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() switch(l->second.GetType()) { case cmTarget::STATIC_LIBRARY: + case cmTarget::OBJECT_LIBRARY: this->SetBuildType(STATIC_LIBRARY, l->first.c_str(), l->second); break; case cmTarget::SHARED_LIBRARY: @@ -336,9 +338,6 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, } } - // Compute which sources need unique object computation. - this->ComputeObjectNameRequirements(sourceGroups); - // Write the DSP file's header. this->WriteDSPHeader(fout, libName, target, sourceGroups); @@ -358,6 +357,8 @@ void cmLocalVisualStudio6Generator ::WriteGroup(const cmSourceGroup *sg, cmTarget& target, std::ostream &fout, const char *libName) { + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); const std::vector<const cmSourceFile *> &sourceFiles = sg->GetSourceFiles(); // If the group is empty, don't write it at all. @@ -374,28 +375,6 @@ void cmLocalVisualStudio6Generator this->WriteDSPBeginGroup(fout, name.c_str(), ""); } - // Compute the maximum length configuration name. - std::string config_max; - for(std::vector<std::string>::iterator i = this->Configurations.begin(); - i != this->Configurations.end(); ++i) - { - // Strip the subdirectory name out of the configuration name. - std::string config = this->GetConfigName(*i); - if(config.size() > config_max.size()) - { - config_max = config; - } - } - - // Compute the maximum length full path to the intermediate - // files directory for any configuration. This is used to construct - // object file names that do not produce paths that are too long. - std::string dir_max; - dir_max += this->Makefile->GetCurrentOutputDirectory(); - dir_max += "/"; - dir_max += config_max; - dir_max += "/"; - // Loop through each source in the source group. for(std::vector<const cmSourceFile *>::const_iterator sf = sourceFiles.begin(); sf != sourceFiles.end(); ++sf) @@ -406,11 +385,9 @@ void cmLocalVisualStudio6Generator std::string compileFlags; std::vector<std::string> depends; std::string objectNameDir; - if(this->NeedObjectName.find(*sf) != this->NeedObjectName.end()) + if(gt->ExplicitObjectName.find(*sf) != gt->ExplicitObjectName.end()) { - objectNameDir = - cmSystemTools::GetFilenamePath( - this->GetObjectFileNameWithoutTarget(*(*sf), dir_max)); + objectNameDir = cmSystemTools::GetFilenamePath(gt->Objects[*sf]); } // Add per-source file flags. @@ -1264,8 +1241,18 @@ void cmLocalVisualStudio6Generator outputNameMinSizeRel = target.GetFullName("MinSizeRel"); outputNameRelWithDebInfo = target.GetFullName("RelWithDebInfo"); } + else if(target.GetType() == cmTarget::OBJECT_LIBRARY) + { + outputName = target.GetName(); + outputName += ".lib"; + outputNameDebug = outputName; + outputNameRelease = outputName; + outputNameMinSizeRel = outputName; + outputNameRelWithDebInfo = outputName; + } // Compute the output directory for the target. + std::string outputDirOld; std::string outputDirDebug; std::string outputDirRelease; std::string outputDirMinSizeRel; @@ -1275,6 +1262,11 @@ void cmLocalVisualStudio6Generator target.GetType() == cmTarget::SHARED_LIBRARY || target.GetType() == cmTarget::MODULE_LIBRARY) { +#ifdef CM_USE_OLD_VS6 + outputDirOld = + removeQuotes(this->ConvertToOptionallyRelativeOutputPath + (target.GetDirectory().c_str())); +#endif outputDirDebug = removeQuotes(this->ConvertToOptionallyRelativeOutputPath( target.GetDirectory("Debug").c_str())); @@ -1288,6 +1280,14 @@ void cmLocalVisualStudio6Generator removeQuotes(this->ConvertToOptionallyRelativeOutputPath( target.GetDirectory("RelWithDebInfo").c_str())); } + else if(target.GetType() == cmTarget::OBJECT_LIBRARY) + { + std::string outputDir = cmake::GetCMakeFilesDirectoryPostSlash(); + outputDirDebug = outputDir + "Debug"; + outputDirRelease = outputDir + "Release"; + outputDirMinSizeRel = outputDir + "MinSizeRel"; + outputDirRelWithDebInfo = outputDir + "RelWithDebInfo"; + } // Compute the proper link information for the target. std::string optionsDebug; @@ -1456,7 +1456,8 @@ void cmLocalVisualStudio6Generator libnameExports.c_str()); cmSystemTools::ReplaceString(line, "CMAKE_MFC_FLAG", mfcFlag); - if(target.GetType() == cmTarget::STATIC_LIBRARY ) + if(target.GetType() == cmTarget::STATIC_LIBRARY || + target.GetType() == cmTarget::OBJECT_LIBRARY) { cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_DEBUG", staticLibOptionsDebug.c_str()); @@ -1555,7 +1556,7 @@ void cmLocalVisualStudio6Generator (exePath.c_str())).c_str()); #endif - if(targetBuilds) + if(targetBuilds || target.GetType() == cmTarget::OBJECT_LIBRARY) { cmSystemTools::ReplaceString(line, "OUTPUT_DIRECTORY_DEBUG", outputDirDebug.c_str()); @@ -1565,13 +1566,11 @@ void cmLocalVisualStudio6Generator outputDirMinSizeRel.c_str()); cmSystemTools::ReplaceString(line, "OUTPUT_DIRECTORY_RELWITHDEBINFO", outputDirRelWithDebInfo.c_str()); -#ifdef CM_USE_OLD_VS6 - std::string outPath = target.GetDirectory(); - cmSystemTools::ReplaceString - (line, "OUTPUT_DIRECTORY", - removeQuotes(this->ConvertToOptionallyRelativeOutputPath - (outPath.c_str())).c_str()); -#endif + if(!outputDirOld.empty()) + { + cmSystemTools::ReplaceString(line, "OUTPUT_DIRECTORY", + outputDirOld.c_str()); + } } cmSystemTools::ReplaceString(line, @@ -1620,11 +1619,13 @@ void cmLocalVisualStudio6Generator flagsDebugRel = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsDebugRel += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" "; } - - // if unicode is not found, then add -D_MBCS + + // if _UNICODE and _SBCS are not found, then add -D_MBCS std::string defs = this->Makefile->GetDefineFlags(); if(flags.find("D_UNICODE") == flags.npos && - defs.find("D_UNICODE") == flags.npos) + defs.find("D_UNICODE") == flags.npos && + flags.find("D_SBCS") == flags.npos && + defs.find("D_SBCS") == flags.npos) { flags += " /D \"_MBCS\""; } @@ -1793,15 +1794,34 @@ cmLocalVisualStudio6Generator return ""; } -void cmLocalVisualStudio6Generator -::GetTargetObjectFileDirectories(cmTarget* , - std::vector<std::string>& - dirs) +//---------------------------------------------------------------------------- +std::string +cmLocalVisualStudio6Generator +::ComputeLongestObjectDirectory(cmTarget&) const { - std::string dir = this->Makefile->GetCurrentOutputDirectory(); - dir += "/"; - dir += this->GetGlobalGenerator()->GetCMakeCFGInitDirectory(); - dirs.push_back(dir); + // Compute the maximum length configuration name. + std::string config_max; + for(std::vector<std::string>::const_iterator + i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + // Strip the subdirectory name out of the configuration name. + std::string config = this->GetConfigName(*i); + if(config.size() > config_max.size()) + { + config_max = config; + } + } + + // Compute the maximum length full path to the intermediate + // files directory for any configuration. This is used to construct + // object file names that do not produce paths that are too long. + std::string dir_max; + dir_max += this->Makefile->GetCurrentOutputDirectory(); + dir_max += "/"; + dir_max += config_max; + dir_max += "/"; + return dir_max; } std::string diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index c9c5dd1..d36d633 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -50,9 +50,7 @@ public: void SetBuildType(BuildType, const char* libName, cmTarget&); virtual std::string GetTargetDirectory(cmTarget const& target) const; - void GetTargetObjectFileDirectories(cmTarget* target, - std::vector<std::string>& - dirs); + virtual std::string ComputeLongestObjectDirectory(cmTarget&) const; private: std::string DSPHeaderTemplate; std::string DSPFooterTemplate; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 1743517..2f145a6 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -17,6 +17,7 @@ #include "cmSystemTools.h" #include "cmSourceFile.h" #include "cmCacheManager.h" +#include "cmGeneratorTarget.h" #include "cmake.h" #include "cmComputeLinkInformation.h" @@ -641,6 +642,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, bool targetBuilds = true; switch(target.GetType()) { + case cmTarget::OBJECT_LIBRARY: + targetBuilds = false; // TODO: PDB for object library? case cmTarget::STATIC_LIBRARY: projectType = "typeStaticLibrary"; configType = "4"; @@ -774,6 +777,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, { fout << "\t\t\tCharacterSet=\"1\">\n"; } + else if(targetOptions.UsingSBCS()) + { + fout << "\t\t\tCharacterSet=\"0\">\n"; + } else { fout << "\t\t\tCharacterSet=\"2\">\n"; @@ -996,6 +1003,22 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } switch(target.GetType()) { + case cmTarget::OBJECT_LIBRARY: + { + std::string libpath = this->GetTargetDirectory(target); + libpath += "/"; + libpath += configName; + libpath += "/"; + libpath += target.GetName(); + libpath += ".lib"; + const char* tool = + this->FortranProject? "VFLibrarianTool":"VCLibrarianTool"; + fout << "\t\t\t<Tool\n" + << "\t\t\t\tName=\"" << tool << "\"\n"; + fout << "\t\t\t\tOutputFile=\"" + << this->ConvertToXMLOutputPathSingle(libpath.c_str()) << "\"/>\n"; + break; + } case cmTarget::STATIC_LIBRARY: { std::string targetNameFull = target.GetFullName(configName); @@ -1306,9 +1329,6 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, sourceGroup.AssignSource(*i); } - // Compute which sources need unique object computation. - this->ComputeObjectNameRequirements(sourceGroups); - // open the project this->WriteProjectStart(fout, libName, target, sourceGroups); // write the configuration information @@ -1348,8 +1368,7 @@ public: cmLocalVisualStudio7GeneratorFCInfo(cmLocalVisualStudio7Generator* lg, cmTarget& target, cmSourceFile const& sf, - std::vector<std::string>* configs, - std::string const& dir_max); + std::vector<std::string>* configs); std::map<cmStdString, cmLVS7GFileConfig> FileConfigMap; }; @@ -1357,13 +1376,14 @@ cmLocalVisualStudio7GeneratorFCInfo ::cmLocalVisualStudio7GeneratorFCInfo(cmLocalVisualStudio7Generator* lg, cmTarget& target, cmSourceFile const& sf, - std::vector<std::string>* configs, - std::string const& dir_max) + std::vector<std::string>* configs) { + cmGeneratorTarget* gt = + lg->GetGlobalGenerator()->GetGeneratorTarget(&target); std::string objectName; - if(lg->NeedObjectName.find(&sf) != lg->NeedObjectName.end()) + if(gt->ExplicitObjectName.find(&sf) != gt->ExplicitObjectName.end()) { - objectName = lg->GetObjectFileNameWithoutTarget(sf, dir_max); + objectName = gt->Objects[&sf]; } // Compute per-source, per-config information. @@ -1474,11 +1494,11 @@ cmLocalVisualStudio7GeneratorFCInfo } } - -void cmLocalVisualStudio7Generator -::ComputeMaxDirectoryLength(std::string& maxdir, - cmTarget& target) -{ +//---------------------------------------------------------------------------- +std::string +cmLocalVisualStudio7Generator +::ComputeLongestObjectDirectory(cmTarget& target) const +{ std::vector<std::string> *configs = static_cast<cmGlobalVisualStudio7Generator *> (this->GlobalGenerator)->GetConfigurations(); @@ -1503,7 +1523,7 @@ void cmLocalVisualStudio7Generator dir_max += "/"; dir_max += config_max; dir_max += "/"; - maxdir = dir_max; + return dir_max; } void cmLocalVisualStudio7Generator @@ -1526,19 +1546,13 @@ void cmLocalVisualStudio7Generator this->WriteVCProjBeginGroup(fout, name.c_str(), ""); } - // Compute the maximum length full path to the intermediate - // files directory for any configuration. This is used to construct - // object file names that do not produce paths that are too long. - std::string dir_max; - this->ComputeMaxDirectoryLength(dir_max, target); - // Loop through each source in the source group. std::string objectName; for(std::vector<const cmSourceFile *>::const_iterator sf = sourceFiles.begin(); sf != sourceFiles.end(); ++sf) { std::string source = (*sf)->GetFullPath(); - FCInfo fcinfo(this, target, *(*sf), configs, dir_max); + FCInfo fcinfo(this, target, *(*sf), configs); if (source != libName || target.GetType() == cmTarget::UTILITY || target.GetType() == cmTarget::GLOBAL_TARGET ) @@ -2114,19 +2128,6 @@ std::string cmLocalVisualStudio7Generator return dir; } -void cmLocalVisualStudio7Generator:: -GetTargetObjectFileDirectories(cmTarget* target, - std::vector<std::string>& - dirs) -{ - std::string dir = this->Makefile->GetCurrentOutputDirectory(); - dir += "/"; - dir += this->GetTargetDirectory(*target); - dir += "/"; - dir += this->GetGlobalGenerator()->GetCMakeCFGInitDirectory(); - dirs.push_back(dir); -} - //---------------------------------------------------------------------------- #include <windows.h> static bool cmLVS6G_IsFAT(const char* dir) diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 5b634b8..9d3a9f2 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -54,20 +54,13 @@ public: void SetBuildType(BuildType,const char *name); void SetPlatformName(const char* n) { this->PlatformName = n;} - void GetTargetObjectFileDirectories(cmTarget* target, - std::vector<std::string>& - dirs); void SetExtraFlagTable(cmVS7FlagTable const* table) { this->ExtraFlagTable = table; } virtual std::string GetTargetDirectory(cmTarget const&) const; cmSourceFile* CreateVCProjBuildRule(); void WriteStampFiles(); - // Compute the maximum length full path to the intermediate - // files directory for any configuration. This is used to construct - // object file names that do not produce paths that are too long. - void ComputeMaxDirectoryLength(std::string& maxdir, - cmTarget& target); + virtual std::string ComputeLongestObjectDirectory(cmTarget&) const; virtual void ReadAndStoreExternalGUID(const char* name, const char* path); diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index de1ac30..4bcf4de 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -65,96 +65,6 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target, } //---------------------------------------------------------------------------- -bool cmLocalVisualStudioGenerator::SourceFileCompiles(const cmSourceFile* sf) -{ - // Identify the language of the source file. - if(const char* lang = this->GetSourceFileLanguage(*sf)) - { - // Check whether this source will actually be compiled. - return (!sf->GetCustomCommand() && - !sf->GetPropertyAsBool("HEADER_FILE_ONLY") && - !sf->GetPropertyAsBool("EXTERNAL_OBJECT")); - } - else - { - // Unknown source file language. Assume it will not be compiled. - return false; - } -} - -//---------------------------------------------------------------------------- -void cmLocalVisualStudioGenerator::CountObjectNames( - const std::vector<cmSourceGroup>& groups, - std::map<cmStdString, int>& counts) -{ - for(unsigned int i = 0; i < groups.size(); ++i) - { - cmSourceGroup sg = groups[i]; - std::vector<const cmSourceFile*> const& srcs = sg.GetSourceFiles(); - for(std::vector<const cmSourceFile*>::const_iterator s = srcs.begin(); - s != srcs.end(); ++s) - { - const cmSourceFile* sf = *s; - if(this->SourceFileCompiles(sf)) - { - std::string objectName = cmSystemTools::LowerCase( - cmSystemTools::GetFilenameWithoutLastExtension( - sf->GetFullPath())); - objectName += ".obj"; - counts[objectName] += 1; - } - } - this->CountObjectNames(sg.GetGroupChildren(), counts); - } -} - -//---------------------------------------------------------------------------- -void cmLocalVisualStudioGenerator::InsertNeedObjectNames( - const std::vector<cmSourceGroup>& groups, - std::map<cmStdString, int>& count) -{ - for(unsigned int i = 0; i < groups.size(); ++i) - { - cmSourceGroup sg = groups[i]; - std::vector<const cmSourceFile*> const& srcs = sg.GetSourceFiles(); - for(std::vector<const cmSourceFile*>::const_iterator s = srcs.begin(); - s != srcs.end(); ++s) - { - const cmSourceFile* sf = *s; - if(this->SourceFileCompiles(sf)) - { - std::string objectName = cmSystemTools::LowerCase( - cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); - objectName += ".obj"; - if(count[objectName] > 1) - { - this->NeedObjectName.insert(sf); - } - } - } - this->InsertNeedObjectNames(sg.GetGroupChildren(), count); - } -} - - -//---------------------------------------------------------------------------- -void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements -(std::vector<cmSourceGroup> const& sourceGroups) -{ - // Clear the current set of requirements. - this->NeedObjectName.clear(); - - // Count the number of object files with each name. Note that - // windows file names are not case sensitive. - std::map<cmStdString, int> objectNameCounts; - this->CountObjectNames(sourceGroups, objectNameCounts); - - // For all source files producing duplicate names we need unique - // object name computation. - this->InsertNeedObjectNames(sourceGroups, objectNameCounts); -} - -//---------------------------------------------------------------------------- const char* cmLocalVisualStudioGenerator::ReportErrorLabel() const { return ":VCReportError"; diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index fcf1f21..410cc9a 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -56,6 +56,8 @@ public: /** Version of Visual Studio. */ VSVersion GetVersion() const { return this->Version; } + virtual std::string ComputeLongestObjectDirectory(cmTarget&) const = 0; + protected: virtual const char* ReportErrorLabel() const; virtual bool CustomCommandUseLocal() const { return false; } @@ -64,16 +66,6 @@ protected: cmsys::auto_ptr<cmCustomCommand> MaybeCreateImplibDir(cmTarget& target, const char* config, bool isFortran); - // Safe object file name generation. - void ComputeObjectNameRequirements(std::vector<cmSourceGroup> const&); - bool SourceFileCompiles(const cmSourceFile* sf); - void CountObjectNames(const std::vector<cmSourceGroup>& groups, - std::map<cmStdString, int>& count); - void InsertNeedObjectNames(const std::vector<cmSourceGroup>& groups, - std::map<cmStdString, int>& count); - std::set<const cmSourceFile*> NeedObjectName; - friend class cmVisualStudio10TargetGenerator; - VSVersion Version; }; diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index b989870..551ebd3 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -33,16 +33,3 @@ cmLocalXCodeGenerator::GetTargetDirectory(cmTarget const&) const // No per-target directory for this generator (yet). return ""; } - -//---------------------------------------------------------------------------- -void cmLocalXCodeGenerator:: -GetTargetObjectFileDirectories(cmTarget* target, - std::vector<std::string>& - dirs) -{ - cmGlobalXCodeGenerator* g = - (cmGlobalXCodeGenerator*)this->GetGlobalGenerator(); - g->SetCurrentLocalGenerator(this); - g->GetTargetObjectFileDirectories(target, - dirs); -} diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index 1ab805d..eab228f 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -27,9 +27,6 @@ public: cmLocalXCodeGenerator(); virtual ~cmLocalXCodeGenerator(); - void GetTargetObjectFileDirectories(cmTarget* target, - std::vector<std::string>& - dirs); virtual std::string GetTargetDirectory(cmTarget const& target) const; private: diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index f81a63d..2599227 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -28,7 +28,7 @@ public: * cmMacroHelperCommand and cmFunctionHelperCommand * which cannot provide appropriate documentation. */ - virtual bool ShouldAppearInDocumentation() + virtual bool ShouldAppearInDocumentation() const { return false; } @@ -50,7 +50,7 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * This is called when the command is first encountered in @@ -65,12 +65,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return this->Args[0].c_str(); } + virtual const char* GetName() const { return this->Args[0].c_str(); } /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { std::string docs = "Macro named: "; docs += this->GetName(); @@ -80,7 +80,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return this->GetTerseDocumentation(); } diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index 93e10b2..36e4b2f 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -15,11 +15,6 @@ #include "cmCommand.h" #include "cmFunctionBlocker.h" -/** \class cmMacroFunctionBlocker - * \brief subclass of function blocker - * - * - */ class cmMacroFunctionBlocker : public cmFunctionBlocker { public: @@ -35,11 +30,7 @@ public: int Depth; }; -/** \class cmMacroCommand - * \brief starts an if block - * - * cmMacroCommand starts an if block - */ +/// Starts macro() ... endmacro() block class cmMacroCommand : public cmCommand { public: @@ -61,17 +52,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "macro";} + virtual const char* GetName() const { return "macro";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Start recording a macro for later invocation as a command."; } @@ -79,7 +70,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " macro(<name> [arg1 [arg2 [arg3 ...]]])\n" diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h index 63b91d1..4e6e1d5 100644 --- a/Source/cmMakeDirectoryCommand.h +++ b/Source/cmMakeDirectoryCommand.h @@ -44,17 +44,17 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "make_directory";} + virtual const char* GetName() const { return "make_directory";} /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the file(MAKE_DIRECTORY ) command instead."; } @@ -62,7 +62,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " make_directory(directory)\n" @@ -72,7 +72,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d206d32..aba2e38 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -209,9 +209,9 @@ cmMakefile::~cmMakefile() { delete *i; } - for(unsigned int i=0; i < this->UsedCommands.size(); i++) + for(unsigned int i=0; i < this->FinalPassCommands.size(); i++) { - delete this->UsedCommands[i]; + delete this->FinalPassCommands[i]; } std::vector<cmFunctionBlocker*>::iterator pos; for (pos = this->FunctionBlockers.begin(); @@ -418,7 +418,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, else if(pcmd->HasFinalPass()) { // use the command - this->UsedCommands.push_back(pcmd.release()); + this->FinalPassCommands.push_back(pcmd.release()); } } else if ( this->GetCMakeInstance()->GetWorkingMode() == cmake::SCRIPT_MODE @@ -810,8 +810,8 @@ void cmMakefile::FinalPass() // give all the commands a chance to do something // after the file has been parsed before generation - for(std::vector<cmCommand*>::iterator i = this->UsedCommands.begin(); - i != this->UsedCommands.end(); ++i) + for(std::vector<cmCommand*>::iterator i = this->FinalPassCommands.begin(); + i != this->FinalPassCommands.end(); ++i) { (*i)->FinalPass(); } @@ -853,6 +853,14 @@ cmMakefile::AddCustomCommandToTarget(const char* target, cmTargets::iterator ti = this->Targets.find(target); if(ti != this->Targets.end()) { + if(ti->second.GetType() == cmTarget::OBJECT_LIBRARY) + { + cmOStringStream e; + e << "Target \"" << target << "\" is an OBJECT library " + "that may not have PRE_BUILD, PRE_LINK, or POST_BUILD commands."; + this->IssueMessage(cmake::FATAL_ERROR, e.str()); + return; + } // Add the command to the appropriate build step for the target. std::vector<std::string> no_output; cmCustomCommand cc(this, no_output, depends, @@ -945,7 +953,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs, outName += ".rule"; const char* dir = this->LocalGenerator->GetGlobalGenerator()-> - GetCMakeCFGInitDirectory(); + GetCMakeCFGIntDir(); if(dir && dir[0] == '$') { cmSystemTools::ReplaceString(outName, dir, @@ -1912,8 +1920,11 @@ cmTarget* cmMakefile::AddLibrary(const char* lname, cmTarget::TargetType type, // wrong type ? default to STATIC if ( (type != cmTarget::STATIC_LIBRARY) && (type != cmTarget::SHARED_LIBRARY) - && (type != cmTarget::MODULE_LIBRARY)) + && (type != cmTarget::MODULE_LIBRARY) + && (type != cmTarget::OBJECT_LIBRARY)) { + this->IssueMessage(cmake::INTERNAL_ERROR, + "cmMakefile::AddLibrary given invalid target type."); type = cmTarget::STATIC_LIBRARY; } @@ -2132,7 +2143,7 @@ void cmMakefile::ExpandVariables() l != this->Targets.end(); ++l) { cmTarget &t = l->second; - const char *includeDirs = t.GetProperty("INCLUDE_DIRECTORIES"); + includeDirs = t.GetProperty("INCLUDE_DIRECTORIES"); if (includeDirs) { std::string dirs = includeDirs; @@ -2865,7 +2876,7 @@ void cmMakefile::EnableLanguage(std::vector<std::string> const & lang, { this->AddDefinition("CMAKE_CFG_INTDIR", this->LocalGenerator->GetGlobalGenerator() - ->GetCMakeCFGInitDirectory()); + ->GetCMakeCFGIntDir()); this->LocalGenerator->GetGlobalGenerator()->EnableLanguage(lang, this, optional); } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index c2939fb..960ba39 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -604,12 +604,6 @@ public: */ bool CanIWriteThisFile(const char* fileName); - /** - * Get the vector of used command instances. - */ - const std::vector<cmCommand*>& GetUsedCommands() const - {return this->UsedCommands;} - #if defined(CMAKE_BUILD_WITH_CMAKE) /** * Get the vector source groups. @@ -895,7 +889,7 @@ protected: std::vector<cmSourceGroup> SourceGroups; #endif - std::vector<cmCommand*> UsedCommands; + std::vector<cmCommand*> FinalPassCommands; cmLocalGenerator* LocalGenerator; bool IsFunctionBlocked(const cmListFileFunction& lff, cmExecutionStatus &status); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index b4174cc..38aa59d 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -101,6 +101,9 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles() this->WriteModuleLibraryRules(true); } break; + case cmTarget::OBJECT_LIBRARY: + this->WriteObjectLibraryRules(); + break; default: // If language is not known, this is an error. cmSystemTools::Error("Unknown Library Type"); @@ -122,6 +125,29 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles() } //---------------------------------------------------------------------------- +void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules() +{ + std::vector<std::string> commands; + std::vector<std::string> depends; + + // Add post-build rules. + this->LocalGenerator-> + AppendCustomCommands(commands, this->Target->GetPostBuildCommands(), + this->Target); + + // Depend on the object files. + this->AppendObjectDepends(depends); + + // Write the rule. + this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, + this->Target->GetName(), + depends, commands, true); + + // Write the main driver rule to build everything in this target. + this->WriteTargetDriverRule(this->Target->GetName(), false); +} + +//---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() { const char* linkLanguage = diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h index f3c47db..e6a5867 100644 --- a/Source/cmMakefileLibraryTargetGenerator.h +++ b/Source/cmMakefileLibraryTargetGenerator.h @@ -25,6 +25,7 @@ public: virtual void WriteRuleFiles(); protected: + void WriteObjectLibraryRules(); void WriteStaticLibraryRules(); void WriteSharedLibraryRules(bool relink); void WriteModuleLibraryRules(bool relink); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index e5be4aa..d0cfd99 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmMakefileTargetGenerator.h" +#include "cmGeneratorTarget.h" #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmGlobalUnixMakefileGenerator3.h" @@ -42,6 +43,7 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmTarget* target) this->GlobalGenerator = static_cast<cmGlobalUnixMakefileGenerator3*>( this->LocalGenerator->GetGlobalGenerator()); + this->GeneratorTarget = this->GlobalGenerator->GetGeneratorTarget(target); cmake* cm = this->GlobalGenerator->GetCMakeInstance(); this->NoRuleMessages = false; if(const char* ruleStatus = cm->GetProperty("RULE_MESSAGES")) @@ -63,6 +65,7 @@ cmMakefileTargetGenerator::New(cmTarget *tgt) case cmTarget::STATIC_LIBRARY: case cmTarget::SHARED_LIBRARY: case cmTarget::MODULE_LIBRARY: + case cmTarget::OBJECT_LIBRARY: result = new cmMakefileLibraryTargetGenerator(tgt); break; case cmTarget::UTILITY: @@ -131,58 +134,46 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() // First generate the object rule files. Save a list of all object // files for this target. - const std::vector<cmSourceFile*>& sources = this->Target->GetSourceFiles(); - for(std::vector<cmSourceFile*>::const_iterator source = sources.begin(); - source != sources.end(); ++source) + for(std::vector<cmSourceFile*>::const_iterator + si = this->GeneratorTarget->CustomCommands.begin(); + si != this->GeneratorTarget->CustomCommands.end(); ++si) { - cmTarget::SourceFileFlags tsFlags = - this->Target->GetTargetSourceFileFlags(*source); - if(cmCustomCommand* cc = (*source)->GetCustomCommand()) + cmCustomCommand const* cc = (*si)->GetCustomCommand(); + this->GenerateCustomRuleFile(*cc); + if (clean) { - this->GenerateCustomRuleFile(*cc); - if (clean) - { - const std::vector<std::string>& outputs = cc->GetOutputs(); - for(std::vector<std::string>::const_iterator o = outputs.begin(); - o != outputs.end(); ++o) - { - this->CleanFiles.push_back - (this->Convert(o->c_str(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::UNCHANGED)); - } - } - } - else if(tsFlags.Type != cmTarget::SourceFileTypeNormal) - { - this->WriteMacOSXContentRules(*(*source), tsFlags.MacFolder); - } - else if(!(*source)->GetPropertyAsBool("HEADER_FILE_ONLY")) - { - if(!this->GlobalGenerator->IgnoreFile - ((*source)->GetExtension().c_str())) - { - // Generate this object file's rule file. - this->WriteObjectRuleFiles(*(*source)); - } - else if((*source)->GetPropertyAsBool("EXTERNAL_OBJECT")) - { - // This is an external object file. Just add it. - this->ExternalObjects.push_back((*source)->GetFullPath()); - } - else if(cmSystemTools::UpperCase((*source)->GetExtension()) == "DEF") - { - this->ModuleDefinitionFile = (*source)->GetFullPath(); - } - else + const std::vector<std::string>& outputs = cc->GetOutputs(); + for(std::vector<std::string>::const_iterator o = outputs.begin(); + o != outputs.end(); ++o) { - // We only get here if a source file is not an external object - // and has an extension that is listed as an ignored file type - // for this language. No message or diagnosis should be - // given. + this->CleanFiles.push_back + (this->Convert(o->c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED)); } } } + for(std::vector<cmSourceFile*>::const_iterator + si = this->GeneratorTarget->OSXContent.begin(); + si != this->GeneratorTarget->OSXContent.end(); ++si) + { + cmTarget::SourceFileFlags tsFlags = + this->Target->GetTargetSourceFileFlags(*si); + this->WriteMacOSXContentRules(**si, tsFlags.MacFolder); + } + for(std::vector<cmSourceFile*>::const_iterator + si = this->GeneratorTarget->ExternalObjects.begin(); + si != this->GeneratorTarget->ExternalObjects.end(); ++si) + { + this->ExternalObjects.push_back((*si)->GetFullPath()); + } + for(std::vector<cmSourceFile*>::const_iterator + si = this->GeneratorTarget->ObjectSources.begin(); + si != this->GeneratorTarget->ObjectSources.end(); ++si) + { + // Generate this object file's rule file. + this->WriteObjectRuleFiles(**si); + } } @@ -428,12 +419,10 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) } // Get the full path name of the object file. - bool hasSourceExtension; - std::string objNoTargetDir; - std::string obj = - this->LocalGenerator->GetObjectFileName(*this->Target, source, - &objNoTargetDir, - &hasSourceExtension); + std::string const& objectName = this->GeneratorTarget->Objects[&source]; + std::string obj = this->LocalGenerator->GetTargetDirectory(*this->Target); + obj += "/"; + obj += objectName; // Avoid generating duplicate rules. if(this->ObjectFiles.find(obj) == this->ObjectFiles.end()) @@ -487,18 +476,6 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) AddImplicitDepends(*this->Target, lang, objFullPath.c_str(), srcFullPath.c_str()); - - // add this to the list of objects for this local generator - if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str())) - { - objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir); - } - cmLocalUnixMakefileGenerator3::LocalObjectInfo& info = - this->LocalGenerator->LocalObjectFiles[objNoTargetDir]; - info.HasSourceExtension = hasSourceExtension; - info.push_back( - cmLocalUnixMakefileGenerator3::LocalObjectEntry(this->Target, lang) - ); } //---------------------------------------------------------------------------- @@ -1620,7 +1597,7 @@ void cmMakefileTargetGenerator //---------------------------------------------------------------------------- void cmMakefileTargetGenerator -::AppendLinkDepends(std::vector<std::string>& depends) +::AppendObjectDepends(std::vector<std::string>& depends) { // Add dependencies on the compiled object files. std::string relPath = this->LocalGenerator->GetHomeRelativeOutputPath(); @@ -1633,25 +1610,32 @@ void cmMakefileTargetGenerator depends.push_back(objTarget); } - // Add dependencies on targets that must be built first. - this->AppendTargetDepends(depends); + // Add dependencies on the external object files. + for(std::vector<std::string>::const_iterator obj + = this->ExternalObjects.begin(); + obj != this->ExternalObjects.end(); ++obj) + { + depends.push_back(*obj); + } // Add a dependency on the rule file itself. this->LocalGenerator->AppendRuleDepend(depends, this->BuildFileNameFull.c_str()); +} - // Add a dependency on the link definitions file, if any. - if(!this->ModuleDefinitionFile.empty()) - { - depends.push_back(this->ModuleDefinitionFile); - } +//---------------------------------------------------------------------------- +void cmMakefileTargetGenerator +::AppendLinkDepends(std::vector<std::string>& depends) +{ + this->AppendObjectDepends(depends); - // Add dependencies on the external object files. - for(std::vector<std::string>::const_iterator obj - = this->ExternalObjects.begin(); - obj != this->ExternalObjects.end(); ++obj) + // Add dependencies on targets that must be built first. + this->AppendTargetDepends(depends); + + // Add a dependency on the link definitions file, if any. + if(!this->GeneratorTarget->ModuleDefinitionFile.empty()) { - depends.push_back(*obj); + depends.push_back(this->GeneratorTarget->ModuleDefinitionFile); } // Add user-specified dependencies. @@ -1979,7 +1963,7 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags) //---------------------------------------------------------------------------- void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) { - if(this->ModuleDefinitionFile.empty()) + if(this->GeneratorTarget->ModuleDefinitionFile.empty()) { return; } @@ -1996,7 +1980,7 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) // vs6's "cl -link" pass it to the linker. std::string flag = defFileFlag; flag += (this->LocalGenerator->ConvertToLinkReference( - this->ModuleDefinitionFile.c_str())); + this->GeneratorTarget->ModuleDefinitionFile.c_str())); this->LocalGenerator->AppendFlags(flags, flag.c_str()); } diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 8fba13f..e1e554b 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -17,6 +17,7 @@ class cmCustomCommand; class cmDependInformation; class cmDepends; +class cmGeneratorTarget; class cmGeneratedFileStream; class cmGlobalUnixMakefileGenerator3; class cmLocalUnixMakefileGenerator3; @@ -117,6 +118,9 @@ protected: // append intertarget dependencies void AppendTargetDepends(std::vector<std::string>& depends); + // Append object file dependencies. + void AppendObjectDepends(std::vector<std::string>& depends); + // Append link rule dependencies (objects, etc.). void AppendLinkDepends(std::vector<std::string>& depends); @@ -157,6 +161,7 @@ protected: void RemoveForbiddenFlags(const char* flagVar, const char* linkLang, std::string& linkFlags); cmTarget *Target; + cmGeneratorTarget* GeneratorTarget; cmLocalUnixMakefileGenerator3 *LocalGenerator; cmGlobalUnixMakefileGenerator3 *GlobalGenerator; cmMakefile *Makefile; @@ -198,9 +203,6 @@ protected: std::vector<std::string> Objects; std::vector<std::string> ExternalObjects; - // The windows module definition source file (.def), if any. - std::string ModuleDefinitionFile; - // Set of object file names that will be built in this directory. std::set<cmStdString> ObjectFiles; diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h index 26e0a07..3658dbb 100644 --- a/Source/cmMarkAsAdvancedCommand.h +++ b/Source/cmMarkAsAdvancedCommand.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "mark_as_advanced";} + virtual const char* GetName() const {return "mark_as_advanced";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Mark cmake cached variables as advanced."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " mark_as_advanced([CLEAR|FORCE] VAR VAR2 VAR...)\n" @@ -75,7 +75,7 @@ public: * make many of the modules usable in cmake/ctest scripts, (among them * FindUnixMake.cmake used by the CTEST_BUILD command. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } cmTypeMacro(cmMarkAsAdvancedCommand, cmCommand); }; diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h index d31f34b..d622904 100644 --- a/Source/cmMathCommand.h +++ b/Source/cmMathCommand.h @@ -14,10 +14,7 @@ #include "cmCommand.h" -/** \class cmMathCommand - * \brief Common string operations - * - */ +/// Mathematical expressions: math(EXPR ...) command. class cmMathCommand : public cmCommand { public: @@ -39,17 +36,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "math";} + virtual const char* GetName() const { return "math";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Mathematical expressions."; } @@ -57,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " math(EXPR <output variable> <math expression>)\n" diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h index 932ee77..03ab94b 100644 --- a/Source/cmMessageCommand.h +++ b/Source/cmMessageCommand.h @@ -39,17 +39,17 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "message";} + virtual const char* GetName() const { return "message";} /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Display a message to the user."; } @@ -57,7 +57,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " message([STATUS|WARNING|AUTHOR_WARNING|FATAL_ERROR|SEND_ERROR]\n" diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h index fa5abd8..da31332 100644 --- a/Source/cmOptionCommand.h +++ b/Source/cmOptionCommand.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "option";} + virtual const char* GetName() const {return "option";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Provides an option that the user can optionally select."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " option(<option_variable> \"help string describing option\"\n" @@ -68,7 +68,7 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } cmTypeMacro(cmOptionCommand, cmCommand); }; diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h index 6038472..85d9095 100644 --- a/Source/cmOutputRequiredFilesCommand.h +++ b/Source/cmOutputRequiredFilesCommand.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "output_required_files";} + virtual const char* GetName() const { return "output_required_files";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Approximate C preprocessor dependency scanning."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "This command exists only because ancient CMake versions provided it. " @@ -67,7 +67,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 2160f37..3106248 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -21,8 +21,9 @@ class cmPolicy; /** \class cmPolicies * \brief Handles changes in CMake behavior and policies * - * See the cmake wiki section on policies for an overview of this class's - * purpose + * See the cmake wiki section on + * <a href="http://www.cmake.org/Wiki/CMake/Policies">policies</a> + * for an overview of this class's purpose */ class cmPolicies { @@ -30,32 +31,46 @@ public: cmPolicies(); ~cmPolicies(); - enum PolicyStatus { OLD, WARN, NEW, REQUIRED_IF_USED, REQUIRED_ALWAYS }; + /// Status of a policy + enum PolicyStatus { + OLD, ///< Use old behavior + WARN, ///< Use old behavior but issue a warning + NEW, ///< Use new behavior + /// Issue an error if user doesn't set policy status to NEW and hits the + /// check + REQUIRED_IF_USED, + REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW. + }; static const char* PolicyStatusNames[]; + /// Policy identifiers enum PolicyID { - CMP0000, // Policy version specification - CMP0001, // Ignore old compatibility variable - CMP0002, // Target names must be unique - CMP0003, // Linking does not include extra -L paths - CMP0004, // Libraries linked may not have leading or trailing whitespace - CMP0005, // Definition value escaping - CMP0006, // BUNDLE install rules needed for MACOSX_BUNDLE targets - CMP0007, // list command handling of empty elements - CMP0008, // Full-path libraries must be a valid library file name - CMP0009, // GLOB_RECURSE should not follow symlinks by default - CMP0010, // Bad variable reference syntax is an error - CMP0011, // Strong policy scope for include and find_package - CMP0012, // Recognize numbers and boolean constants in if() - CMP0013, // Duplicate binary directories not allowed - CMP0014, // Input directories must have CMakeLists.txt - CMP0015, // link_directories() treats paths relative to source dir - CMP0016, // target_link_libraries() fails if only argument is not a target - CMP0017, // Prefer files in CMAKE_ROOT when including from CMAKE_ROOT - - // Always the last entry. Useful mostly to avoid adding a comma - // the last policy when adding a new one. + CMP0000, ///< Policy version specification + CMP0001, ///< Ignore old compatibility variable + CMP0002, ///< Target names must be unique + CMP0003, ///< Linking does not include extra -L paths + CMP0004, ///< Libraries linked may not have leading or trailing whitespace + CMP0005, ///< Definition value escaping + CMP0006, ///< BUNDLE install rules needed for MACOSX_BUNDLE targets + CMP0007, ///< list command handling of empty elements + CMP0008, ///< Full-path libraries must be a valid library file name + CMP0009, ///< GLOB_RECURSE should not follow symlinks by default + CMP0010, ///< Bad variable reference syntax is an error + CMP0011, ///< Strong policy scope for include and find_package + CMP0012, ///< Recognize numbers and boolean constants in if() + CMP0013, ///< Duplicate binary directories not allowed + CMP0014, ///< Input directories must have CMakeLists.txt + CMP0015, ///< link_directories() treats paths relative to source dir + /// target_link_libraries() fails if only argument is not a target + CMP0016, + CMP0017, ///< Prefer files in CMAKE_ROOT when including from CMAKE_ROOT + + /** \brief Always the last entry. + * + * Useful mostly to avoid adding a comma the last policy when adding a new + * one. + */ CMPCOUNT }; diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 6e3b6af..fcf0a49 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -77,6 +77,24 @@ bool cmProjectCommand languages.push_back("CXX"); } this->Makefile->EnableLanguage(languages, false); + std::string extraInclude = "CMAKE_PROJECT_" + args[0] + "_INCLUDE"; + const char* include = this->Makefile->GetDefinition(extraInclude.c_str()); + if(include) + { + std::string fullFilePath; + bool readit = + this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(), + include); + if(!readit && !cmSystemTools::GetFatalErrorOccured()) + { + std::string m = + "could not find file:\n" + " "; + m += include; + this->SetError(m.c_str()); + return false; + } + } return true; } diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index fc2b7a2..4b051af 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -43,12 +43,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "project";} + virtual const char* GetName() const {return "project";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Set a name for the entire project."; } @@ -56,7 +56,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " project(<projectname> [languageName1 languageName2 ... ] )\n" @@ -68,7 +68,10 @@ public: "By default C and CXX are enabled. E.g. if you do not have a " "C++ compiler, you can disable the check for it by explicitly listing " "the languages you want to support, e.g. C. By using the special " - "language \"NONE\" all checks for any language can be disabled."; + "language \"NONE\" all checks for any language can be disabled. " + "If a variable exists called CMAKE_PROJECT_<projectName>_INCLUDE_FILE, " + "the file pointed to by that variable will be included as the last step " + "of the project command."; } cmTypeMacro(cmProjectCommand, cmCommand); diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h index f68db87..16bd148 100644 --- a/Source/cmPropertyDefinition.h +++ b/Source/cmPropertyDefinition.h @@ -14,45 +14,56 @@ #include "cmProperty.h" -class cmPropertyDefinition +/** \class cmPropertyDefinition + * \brief Property meta-information + * + * This class contains the following meta-information about property: + * - Name; + * - Various documentation strings; + * - The scope of the property; + * - If the property is chained. + */ +class cmPropertyDefinition { public: - // Define this property + /// Define this property void DefineProperty(const char *name, cmProperty::ScopeType scope, const char *ShortDescription, const char *FullDescription, const char *DocumentationSection, bool chained); - // get the documentation string + /// Get the documentation string cmDocumentationEntry GetDocumentation() const; - // basic constructor + /// Default constructor cmPropertyDefinition() { this->Chained = false; }; - // is it chained? - bool IsChained() {return this->Chained; }; + /// Is the property chained? + bool IsChained() const { return this->Chained; }; - // Get the section if any + /// Get the section if any const std::string &GetDocumentationSection() const { return this->DocumentationSection; }; - - // get the scope + + /// Get the scope cmProperty::ScopeType GetScope() const { return this->Scope; }; - // get the docs + /// Get the documentation (short version) const std::string &GetShortDescription() const { - return this->ShortDescription; }; + return this->ShortDescription; }; + + /// Get the documentation (full version) const std::string &GetFullDescription() const { return this->FullDescription; }; - + protected: std::string Name; std::string ShortDescription; std::string FullDescription; std::string DocumentationSection; - cmProperty::ScopeType Scope; + cmProperty::ScopeType Scope; bool Chained; }; diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h index f972e10..0184927 100644 --- a/Source/cmQTWrapCPPCommand.h +++ b/Source/cmQTWrapCPPCommand.h @@ -45,12 +45,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "qt_wrap_cpp";} + virtual const char* GetName() const { return "qt_wrap_cpp";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Create Qt Wrappers."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " qt_wrap_cpp(resultingLibraryName DestName\n" diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h index 67e914f..744ae98 100644 --- a/Source/cmQTWrapUICommand.h +++ b/Source/cmQTWrapUICommand.h @@ -43,12 +43,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "qt_wrap_ui";} + virtual const char* GetName() const { return "qt_wrap_ui";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Create Qt user interfaces Wrappers."; } @@ -56,7 +56,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " qt_wrap_ui(resultingLibraryName HeadersDestName\n" diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h index bae2ee1..c62d58f 100644 --- a/Source/cmRemoveCommand.h +++ b/Source/cmRemoveCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "remove";} + virtual const char* GetName() const {return "remove";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the list(REMOVE_ITEM ) command instead."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " remove(VAR VALUE VALUE ...)\n" @@ -68,7 +68,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h index 519bc42..f0e906d 100644 --- a/Source/cmRemoveDefinitionsCommand.h +++ b/Source/cmRemoveDefinitionsCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "remove_definitions";} + virtual const char* GetName() const {return "remove_definitions";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Removes -D define flags added by add_definitions."; } @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " remove_definitions(-DFOO -DBAR ...)\n" diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h index 3739e83..690ab79 100644 --- a/Source/cmReturnCommand.h +++ b/Source/cmReturnCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "return";} + virtual const char* GetName() const {return "return";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Return from a file, directory or function."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " return()\n" diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h index 736f066..6a51a92 100644 --- a/Source/cmSeparateArgumentsCommand.h +++ b/Source/cmSeparateArgumentsCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "separate_arguments";} + virtual const char* GetName() const {return "separate_arguments";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Parse space-separated arguments into a semicolon-separated list."; @@ -59,7 +59,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " separate_arguments(<var> <UNIX|WINDOWS>_COMMAND \"<args>\")\n" diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h index 2990d24..66b129e 100644 --- a/Source/cmSetCommand.h +++ b/Source/cmSetCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "set";} + virtual const char* GetName() const {return "set";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Set a CMAKE variable to a given value."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " set(<variable> <value>\n" diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h index 227571f..ee40158 100644 --- a/Source/cmSetDirectoryPropertiesCommand.h +++ b/Source/cmSetDirectoryPropertiesCommand.h @@ -32,17 +32,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "set_directory_properties";} + virtual const char* GetName() const { return "set_directory_properties";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Set a property of the directory."; } @@ -58,7 +58,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " set_directory_properties(PROPERTIES prop1 value1 prop2 value2)\n" diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index 3a0169e..830299d 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -34,12 +34,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "set_property";} + virtual const char* GetName() const { return "set_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Set a named property in a given scope."; } @@ -47,7 +47,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " set_property(<GLOBAL |\n" @@ -86,7 +86,7 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } cmTypeMacro(cmSetPropertyCommand, cmCommand); diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h index 392f168..2a67bc0 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.h +++ b/Source/cmSetSourceFilesPropertiesCommand.h @@ -32,12 +32,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "set_source_files_properties";} + virtual const char* GetName() const { return "set_source_files_properties";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Source files can have properties that affect how they are built."; } @@ -45,7 +45,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " set_source_files_properties([file1 [file2 [...]]]\n" diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index f001a11..1bc429c 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -32,12 +32,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "set_target_properties";} + virtual const char* GetName() const { return "set_target_properties";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Targets can have properties that affect how they are built."; } @@ -52,7 +52,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " set_target_properties(target1 target2 ...\n" diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h index fbc8ac1..10df17d 100644 --- a/Source/cmSetTestsPropertiesCommand.h +++ b/Source/cmSetTestsPropertiesCommand.h @@ -32,12 +32,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "set_tests_properties";} + virtual const char* GetName() const { return "set_tests_properties";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Set a property of the tests."; } @@ -45,7 +45,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2" diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h index ac7f426..532710c 100644 --- a/Source/cmSiteNameCommand.h +++ b/Source/cmSiteNameCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "site_name";} + virtual const char* GetName() const {return "site_name";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Set the given variable to the name of the computer."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " site_name(variable)\n"; diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index 19ae8fc..2b34f2b 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -120,12 +120,6 @@ const std::vector<const cmSourceFile*>& cmSourceGroup::GetSourceFiles() const } //---------------------------------------------------------------------------- -std::vector<const cmSourceFile*>& cmSourceGroup::GetSourceFiles() -{ - return this->SourceFiles; -} - -//---------------------------------------------------------------------------- void cmSourceGroup::AddChild(cmSourceGroup child) { this->Internal->GroupChildren.push_back(child); diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h index 71ccb51..641dcbd 100644 --- a/Source/cmSourceGroup.h +++ b/Source/cmSourceGroup.h @@ -100,7 +100,6 @@ public: * source group. */ const std::vector<const cmSourceFile*>& GetSourceFiles() const; - std::vector<const cmSourceFile*>& GetSourceFiles(); std::vector<cmSourceGroup> const& GetGroupChildren() const; private: diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h index 31508ce..6a29fc8 100644 --- a/Source/cmSourceGroupCommand.h +++ b/Source/cmSourceGroupCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "source_group";} + virtual const char* GetName() const {return "source_group";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Define a grouping for sources in the makefile."; } @@ -54,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " source_group(name [REGULAR_EXPRESSION regex] " diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index 452f4a1..3e585a5 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -45,17 +45,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "string";} + virtual const char* GetName() const { return "string";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "String operations."; } @@ -63,7 +63,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " string(REGEX MATCH <regular_expression>\n" diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h index 3dad67d..eedbfff 100644 --- a/Source/cmSubdirCommand.h +++ b/Source/cmSubdirCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "subdirs";} + virtual const char* GetName() const { return "subdirs";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the add_subdirectory() command instead."; } @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "Add a list of subdirectories to the build.\n" @@ -79,7 +79,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h index 347f97a..daf97cd 100644 --- a/Source/cmSubdirDependsCommand.h +++ b/Source/cmSubdirDependsCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "subdir_depends";} + virtual const char* GetName() const { return "subdir_depends";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Does nothing."; } @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " subdir_depends(subdir dep1 dep2 ...)\n" @@ -64,7 +64,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e618bee..9e86681 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -37,18 +37,14 @@ const char* cmTarget::GetTargetTypeName(TargetType targetType) return "MODULE_LIBRARY"; case cmTarget::SHARED_LIBRARY: return "SHARED_LIBRARY"; + case cmTarget::OBJECT_LIBRARY: + return "OBJECT_LIBRARY"; case cmTarget::EXECUTABLE: return "EXECUTABLE"; case cmTarget::UTILITY: return "UTILITY"; case cmTarget::GLOBAL_TARGET: return "GLOBAL_TARGET"; - case cmTarget::INSTALL_FILES: - return "INSTALL_FILES"; - case cmTarget::INSTALL_PROGRAMS: - return "INSTALL_PROGRAMS"; - case cmTarget::INSTALL_DIRECTORY: - return "INSTALL_DIRECTORY"; case cmTarget::UNKNOWN_LIBRARY: return "UNKNOWN_LIBRARY"; } @@ -887,7 +883,9 @@ void cmTarget::DefineProperties(cmake *cm) "of of just main()." "This makes it a GUI executable instead of a console application. " "See the CMAKE_MFC_FLAG variable documentation to configure use " - "of MFC for WinMain executables."); + "of MFC for WinMain executables. " + "This property is initialized by the value of the variable " + "CMAKE_WIN32_EXECUTABLE if it is set when a target is created."); cm->DefineProperty ("MACOSX_BUNDLE", cmProperty::TARGET, @@ -897,7 +895,9 @@ void cmTarget::DefineProperties(cmake *cm) "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."); + "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."); cm->DefineProperty ("MACOSX_BUNDLE_INFO_PLIST", cmProperty::TARGET, @@ -1103,17 +1103,6 @@ void cmTarget::DefineProperties(cmake *cm) "better if VS_GLOBAL_QtVersion is set to the version " "FindQt4.cmake found. For example, \"4.7.3\""); -#if 0 - cm->DefineProperty - ("OBJECT_FILES", cmProperty::TARGET, - "Used to get the resulting list of object files that make up a " - "target.", - "This can be used to put object files from one library " - "into another library. It is a read only property. It " - "converts the source list for the target into a list of full " - "paths to object names that will be produced by the target."); -#endif - #define CM_TARGET_FILE_TYPES_DOC \ "There are three kinds of target files that may be built: " \ "archive, library, and runtime. " \ @@ -1204,16 +1193,6 @@ void cmTarget::DefineProperties(cmake *cm) void cmTarget::SetType(TargetType type, const char* name) { this->Name = name; - if(type == cmTarget::INSTALL_FILES || - type == cmTarget::INSTALL_PROGRAMS || - type == cmTarget::INSTALL_DIRECTORY) - { - this->Makefile-> - IssueMessage(cmake::INTERNAL_ERROR, - "SetType called on cmTarget for INSTALL_FILES, " - "INSTALL_PROGRAMS, or INSTALL_DIRECTORY "); - return; - } // only add dependency information for library targets this->TargetTypeValue = type; if(this->TargetTypeValue >= STATIC_LIBRARY @@ -1260,6 +1239,8 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SetPropertyDefault("AUTOMOC", 0); this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", 0); this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", 0); + this->SetPropertyDefault("WIN32_EXECUTABLE", 0); + this->SetPropertyDefault("MACOSX_BUNDLE", 0); // Collect the set of configuration types. std::vector<std::string> configNames; @@ -2623,54 +2604,6 @@ const char *cmTarget::GetProperty(const char* prop) } //---------------------------------------------------------------------------- -void cmTarget::ComputeObjectFiles() -{ - if (this->IsImported()) - { - return; - } -#if 0 - std::vector<std::string> dirs; - this->Makefile->GetLocalGenerator()-> - GetTargetObjectFileDirectories(this, - dirs); - std::string objectFiles; - std::string objExtensionLookup1 = "CMAKE_"; - std::string objExtensionLookup2 = "_OUTPUT_EXTENSION"; - - for(std::vector<std::string>::iterator d = dirs.begin(); - d != dirs.end(); ++d) - { - for(std::vector<cmSourceFile*>::iterator s = this->SourceFiles.begin(); - s != this->SourceFiles.end(); ++s) - { - cmSourceFile* sf = *s; - if(const char* lang = sf->GetLanguage()) - { - std::string lookupObj = objExtensionLookup1 + lang; - lookupObj += objExtensionLookup2; - const char* obj = this->Makefile->GetDefinition(lookupObj.c_str()); - if(obj) - { - if(objectFiles.size()) - { - objectFiles += ";"; - } - std::string objFile = *d; - objFile += "/"; - objFile += this->Makefile->GetLocalGenerator()-> - GetSourceObjectName(*sf); - objFile += obj; - objectFiles += objFile; - } - } - } - } - this->SetProperty("OBJECT_FILES", objectFiles.c_str()); -#endif -} - -//---------------------------------------------------------------------------- const char *cmTarget::GetProperty(const char* prop, cmProperty::ScopeType scope) { @@ -3627,7 +3560,8 @@ bool cmTarget::HaveBuildTreeRPATH() bool cmTarget::HaveInstallTreeRPATH() { const char* install_rpath = this->GetProperty("INSTALL_RPATH"); - return install_rpath && *install_rpath; + return (install_rpath && *install_rpath) && + !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH"); } //---------------------------------------------------------------------------- @@ -3734,7 +3668,8 @@ std::string cmTarget::GetInstallNameDirForInstallTree(const char* config, { std::string dir; - if(!this->Makefile->IsOn("CMAKE_SKIP_RPATH")) + if(!this->Makefile->IsOn("CMAKE_SKIP_RPATH") && + !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH")) { const char* install_name_dir = this->GetProperty("INSTALL_NAME_DIR"); if(install_name_dir && *install_name_dir) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index dfed499..e2502f0 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -59,8 +59,8 @@ class cmTarget public: cmTarget(); enum TargetType { EXECUTABLE, STATIC_LIBRARY, - SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, GLOBAL_TARGET, - INSTALL_FILES, INSTALL_PROGRAMS, INSTALL_DIRECTORY, + SHARED_LIBRARY, MODULE_LIBRARY, + OBJECT_LIBRARY, UTILITY, GLOBAL_TARGET, UNKNOWN_LIBRARY}; static const char* GetTargetTypeName(TargetType targetType); enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD }; @@ -404,9 +404,6 @@ public: // Define the properties static void DefineProperties(cmake *cm); - // Compute the OBJECT_FILES property only when requested - void ComputeObjectFiles(); - /** Get the macro to define when building sources in this target. If no macro should be defined null is returned. */ const char* GetExportMacro(); diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 36c4ca8..dbea1c3 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -84,6 +84,16 @@ bool cmTargetLinkLibrariesCommand return true; } + if(this->Target->GetType() == cmTarget::OBJECT_LIBRARY) + { + cmOStringStream e; + e << "Object library target \"" << args[0] << "\" " + << "may not link to anything."; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + cmSystemTools::SetFatalErrorOccured(); + return true; + } + // but we might not have any libs after variable expansion if(args.size() < 2) { diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index 8df4ac0..be866c3 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "target_link_libraries";} + virtual const char* GetName() const { return "target_link_libraries";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Link a target to given libraries."; @@ -56,7 +56,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " target_link_libraries(<target> [item1 [item2 [...]]]\n" diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h index 0d57633..68ec666 100644 --- a/Source/cmTryCompileCommand.h +++ b/Source/cmTryCompileCommand.h @@ -40,19 +40,19 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "try_compile";} + virtual const char* GetName() const { return "try_compile";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Try building some code."; } /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " try_compile(RESULT_VAR <bindir> <srcdir>\n" diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h index f86d863..06a9118 100644 --- a/Source/cmTryRunCommand.h +++ b/Source/cmTryRunCommand.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "try_run";} + virtual const char* GetName() const { return "try_run";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Try compiling and then running some code."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR\n" diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h index 28f8cf4..9cf95d9 100644 --- a/Source/cmUnsetCommand.h +++ b/Source/cmUnsetCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "unset";} + virtual const char* GetName() const {return "unset";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Unset a variable, cache variable, or environment variable."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " unset(<variable> [CACHE])\n" diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h index fec2265..2f52960 100644 --- a/Source/cmUseMangledMesaCommand.h +++ b/Source/cmUseMangledMesaCommand.h @@ -45,12 +45,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "use_mangled_mesa";} + virtual const char* GetName() const { return "use_mangled_mesa";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Copy mesa headers for use in combination with system GL."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " use_mangled_mesa(PATH_TO_MESA OUTPUT_DIRECTORY)\n" @@ -71,10 +71,10 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h index 6c23814..32afdda 100644 --- a/Source/cmUtilitySourceCommand.h +++ b/Source/cmUtilitySourceCommand.h @@ -44,12 +44,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "utility_source";} + virtual const char* GetName() const { return "utility_source";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Specify the source tree of a third-party utility."; } @@ -57,7 +57,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " utility_source(cache_entry executable_name\n" @@ -76,7 +76,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h index f165f39..91c351e 100644 --- a/Source/cmVariableRequiresCommand.h +++ b/Source/cmVariableRequiresCommand.h @@ -39,12 +39,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "variable_requires";} + virtual const char* GetName() const { return "variable_requires";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the if() command instead."; } @@ -52,7 +52,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "Assert satisfaction of an option's required variables.\n" @@ -70,7 +70,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h index e2fb934..cb80736 100644 --- a/Source/cmVariableWatchCommand.h +++ b/Source/cmVariableWatchCommand.h @@ -49,7 +49,7 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** This command does not really have a final pass but it needs to stay alive since it owns variable watch callback information. */ @@ -58,12 +58,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "variable_watch";} + virtual const char* GetName() const { return "variable_watch";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Watch the CMake variable for change."; } @@ -71,7 +71,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " variable_watch(<variable name> [<command to execute>])\n" diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index f9148a1..db37dfc 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmVisualStudio10TargetGenerator.h" #include "cmGlobalVisualStudio10Generator.h" +#include "cmGeneratorTarget.h" #include "cmTarget.h" #include "cmComputeLinkInformation.h" #include "cmGeneratedFileStream.h" @@ -62,6 +63,7 @@ cmVisualStudio10TargetGenerator(cmTarget* target, { this->GlobalGenerator = gg; this->Target = target; + this->GeneratorTarget = gg->GetGeneratorTarget(target); this->Makefile = target->GetMakefile(); this->LocalGenerator = (cmLocalVisualStudio7Generator*) @@ -70,7 +72,6 @@ cmVisualStudio10TargetGenerator(cmTarget* target, this->GlobalGenerator->CreateGUID(this->Name.c_str()); this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str()); this->Platform = gg->GetPlatformName(); - this->ComputeObjectNames(); this->BuildFileStream = 0; } @@ -147,7 +148,7 @@ void cmVisualStudio10TargetGenerator::Generate() this->Target->SetProperty("GENERATOR_FILE_NAME",this->Name.c_str()); this->Target->SetProperty("GENERATOR_FILE_NAME_EXT", ".vcxproj"); - if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY) + if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY) { if(!this->ComputeClOptions()) { @@ -358,6 +359,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() case cmTarget::MODULE_LIBRARY: configType += "DynamicLibrary"; break; + case cmTarget::OBJECT_LIBRARY: case cmTarget::STATIC_LIBRARY: configType += "StaticLibrary"; break; @@ -388,12 +390,17 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() mfcLine += useOfMfcValue + "</UseOfMfc>\n"; this->WriteString(mfcLine.c_str(), 2); - if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY && + if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY && this->ClOptions[*i]->UsingUnicode() || this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) { this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2); } + else if (this->Target->GetType() <= cmTarget::MODULE_LIBRARY && + this->ClOptions[*i]->UsingSBCS()) + { + this->WriteString("<CharacterSet>NotSet</CharacterSet>\n", 2); + } else { this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2); @@ -416,12 +423,11 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() void cmVisualStudio10TargetGenerator::WriteCustomCommands() { this->SourcesVisited.clear(); - std::vector<cmSourceFile*> const& sources = this->Target->GetSourceFiles(); - for(std::vector<cmSourceFile*>::const_iterator source = sources.begin(); - source != sources.end(); ++source) + for(std::vector<cmSourceFile*>::const_iterator + si = this->GeneratorTarget->CustomCommands.begin(); + si != this->GeneratorTarget->CustomCommands.end(); ++si) { - cmSourceFile* sf = *source; - this->WriteCustomCommand(sf); + this->WriteCustomCommand(*si); } } @@ -870,47 +876,17 @@ void cmVisualStudio10TargetGenerator::WriteCLSources() this->WriteString("</ItemGroup>\n", 1); } -void cmVisualStudio10TargetGenerator::ComputeObjectNames() -{ - // We may be modifying the source groups temporarily, so make a copy. - std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups(); - - // get the classes from the source lists then add them to the groups - std::vector<cmSourceFile*>const & classes = this->Target->GetSourceFiles(); - for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); - i != classes.end(); i++) - { - // Add the file to the list of sources. - std::string source = (*i)->GetFullPath(); - if(cmSystemTools::UpperCase((*i)->GetExtension()) == "DEF") - { - this->ModuleDefinitionFile = (*i)->GetFullPath(); - } - cmSourceGroup& sourceGroup = - this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); - sourceGroup.AssignSource(*i); - } - - // Compute which sources need unique object computation. - this->LocalGenerator->ComputeObjectNameRequirements(sourceGroups); -} - bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( cmSourceFile* source) { cmSourceFile& sf = *source; cmLocalVisualStudio7Generator* lg = this->LocalGenerator; - // Compute the maximum length full path to the intermediate - // files directory for any configuration. This is used to construct - // object file names that do not produce paths that are too long. - std::string dir_max; - lg->ComputeMaxDirectoryLength(dir_max, *this->Target); - std::string objectName; - if(lg->NeedObjectName.find(&sf) != lg->NeedObjectName.end()) + if(this->GeneratorTarget->ExplicitObjectName.find(&sf) + != this->GeneratorTarget->ExplicitObjectName.end()) { - objectName = lg->GetObjectFileNameWithoutTarget(sf, dir_max); + objectName = this->GeneratorTarget->Objects[&sf]; } std::string flags; std::string defines; @@ -1031,20 +1007,29 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() } else { - std::string targetNameFull = - this->Target->GetFullName(config->c_str()); std::string intermediateDir = this->LocalGenerator-> GetTargetDirectory(*this->Target); intermediateDir += "/"; intermediateDir += *config; intermediateDir += "/"; + std::string outDir; + std::string targetNameFull; + if(ttype == cmTarget::OBJECT_LIBRARY) + { + outDir = intermediateDir; + targetNameFull = this->Target->GetName(); + targetNameFull += ".lib"; + } + else + { + outDir = this->Target->GetDirectory(config->c_str()) + "/"; + targetNameFull = this->Target->GetFullName(config->c_str()); + } this->ConvertToWindowsSlash(intermediateDir); - std::string outDir = this->Target->GetDirectory(config->c_str()); this->ConvertToWindowsSlash(outDir); this->WritePlatformConfigTag("OutDir", config->c_str(), 3); *this->BuildFileStream << outDir - << "\\" << "</OutDir>\n"; this->WritePlatformConfigTag("IntDir", config->c_str(), 3); @@ -1278,11 +1263,15 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( *this->BuildFileStream << configName << "</AssemblerListingLocation>\n"; this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3); - this->WriteString("<ProgramDataBaseFileName>", 3); - *this->BuildFileStream << this->Target->GetDirectory(configName.c_str()) - << "/" - << this->Target->GetPDBName(configName.c_str()) - << "</ProgramDataBaseFileName>\n"; + if(this->Target->GetType() != cmTarget::OBJECT_LIBRARY) + { + // TODO: PDB for object library? + this->WriteString("<ProgramDataBaseFileName>", 3); + *this->BuildFileStream << this->Target->GetDirectory(configName.c_str()) + << "/" + << this->Target->GetPDBName(configName.c_str()) + << "</ProgramDataBaseFileName>\n"; + } this->WriteString("</ClCompile>\n", 2); } @@ -1514,10 +1503,10 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& linkOptions.AddFlag("ImportLibrary", imLib.c_str()); linkOptions.AddFlag("ProgramDataBaseFile", pdb.c_str()); linkOptions.Parse(flags.c_str()); - if(!this->ModuleDefinitionFile.empty()) + if(!this->GeneratorTarget->ModuleDefinitionFile.empty()) { linkOptions.AddFlag("ModuleDefinitionFile", - this->ModuleDefinitionFile.c_str()); + this->GeneratorTarget->ModuleDefinitionFile.c_str()); } linkOptions.RemoveFlag("GenerateManifest"); @@ -1593,7 +1582,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() this->WritePlatformConfigTag("ItemDefinitionGroup", i->c_str(), 1); *this->BuildFileStream << "\n"; // output cl compile flags <ClCompile></ClCompile> - if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY) + if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY) { this->WriteClOptions(*i, includes); // output rc compile flags <ResourceCompile></ResourceCompile> diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 90035f2..64fb124 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -15,6 +15,7 @@ class cmTarget; class cmMakefile; +class cmGeneratorTarget; class cmGeneratedFileStream; class cmGlobalVisualStudio10Generator; class cmSourceFile; @@ -75,7 +76,6 @@ private: void WriteEvents(std::string const& configName); void WriteEvent(const char* name, std::vector<cmCustomCommand> & commands, std::string const& configName); - void ComputeObjectNames(); void WriteGroupSources(const char* name, std::vector<cmSourceFile*> const& sources, std::vector<cmSourceGroup>& ); @@ -87,9 +87,9 @@ private: typedef cmVisualStudioGeneratorOptions Options; typedef std::map<cmStdString, Options*> OptionsMap; OptionsMap ClOptions; - std::string ModuleDefinitionFile; std::string PathToVcxproj; cmTarget* Target; + cmGeneratorTarget* GeneratorTarget; cmMakefile* Makefile; std::string Platform; std::string GUID; diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 41230e7..9369af6 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -117,6 +117,20 @@ bool cmVisualStudioGeneratorOptions::UsingUnicode() } return false; } +//---------------------------------------------------------------------------- +bool cmVisualStudioGeneratorOptions::UsingSBCS() +{ + // Look for the a _SBCS definition. + for(std::vector<std::string>::const_iterator di = this->Defines.begin(); + di != this->Defines.end(); ++di) + { + if(*di == "_SBCS") + { + return true; + } + } + return false; +} //---------------------------------------------------------------------------- void cmVisualStudioGeneratorOptions::Parse(const char* flags) diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index 51a1362..a1a55da 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -48,6 +48,7 @@ public: // Check for specific options. bool UsingUnicode(); + bool UsingSBCS(); bool IsDebug(); // Write options to output. diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h index 04649a3..e111ae4 100644 --- a/Source/cmWhileCommand.h +++ b/Source/cmWhileCommand.h @@ -16,11 +16,6 @@ #include "cmFunctionBlocker.h" #include "cmListFileCache.h" -/** \class cmWhileFunctionBlocker - * \brief subclass of function blocker - * - * - */ class cmWhileFunctionBlocker : public cmFunctionBlocker { public: @@ -37,11 +32,7 @@ private: int Depth; }; -/** \class cmWhileCommand - * \brief starts a while loop - * - * cmWhileCommand starts a while loop - */ +/// \brief Starts a while loop class cmWhileCommand : public cmCommand { public: @@ -70,17 +61,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "while";} + virtual const char* GetName() const { return "while";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Evaluate a group of commands while a condition is true"; } @@ -88,7 +79,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " while(condition)\n" diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h index 97ec727..8808d32 100644 --- a/Source/cmWriteFileCommand.h +++ b/Source/cmWriteFileCommand.h @@ -39,17 +39,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "write_file";} + virtual const char* GetName() const { return "write_file";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the file(WRITE ) command instead."; } @@ -57,7 +57,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " write_file(filename \"message to write\"... [APPEND])\n" @@ -73,7 +73,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c5e6d44..846aef5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -135,7 +135,7 @@ void cmNeedBackwardsCompatibility(const std::string& variable, " that has not been defined. Some variables were always defined " "by CMake in versions prior to 1.6. To fix this you might need to set " "the cache value of CMAKE_BACKWARDS_COMPATIBILITY to 1.4 or less. If " - "you are writing a CMakeList file, (or have already set " + "you are writing a CMakeLists file, (or have already set " "CMAKE_BACKWARDS_COMPATABILITY to 1.4 or less) then you probably need " "to include a CMake module to test for the feature this variable " "defines."; @@ -1433,7 +1433,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args) // Command to start progress for a build else if (args[1] == "cmake_progress_start" && args.size() == 4) { - // bascially remove the directory + // basically remove the directory std::string dirName = args[2]; dirName += "/Progress"; cmSystemTools::RemoveADirectory(dirName.c_str()); @@ -1930,7 +1930,7 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) { delete this->GlobalGenerator; // restore the original environment variables CXX and CC - // Restor CC + // Restore CC std::string env = "CC="; if(this->CCEnvironment.size()) { @@ -2612,7 +2612,7 @@ int cmake::LoadCache() // could we not read the cache if (!this->CacheManager->LoadCache(this->GetHomeOutputDirectory())) { - // if it does exist, but isn;t readable then warn the user + // if it does exist, but isn't readable then warn the user std::string cacheFile = this->GetHomeOutputDirectory(); cacheFile += "/CMakeCache.txt"; if(cmSystemTools::FileExists(cacheFile.c_str())) @@ -3373,19 +3373,21 @@ void cmake::DefineProperties(cmake *cm) cm->DefineProperty ("ENABLED_FEATURES", cmProperty::GLOBAL, "List of features which are enabled during the CMake run.", - "List of features which are enabled during the CMake run. Be default " + "List of features which are enabled during the CMake run. By default " "it contains the names of all packages which were found. This is " "determined using the <NAME>_FOUND variables. Packages which are " "searched QUIET are not listed. A project can add its own features to " - "this list.This property is used by the macros in FeatureSummary.cmake."); + "this list. " + "This property is used by the macros in FeatureSummary.cmake."); cm->DefineProperty ("DISABLED_FEATURES", cmProperty::GLOBAL, "List of features which are disabled during the CMake run.", - "List of features which are disabled during the CMake run. Be default " + "List of features which are disabled during the CMake run. By default " "it contains the names of all packages which were not found. This is " "determined using the <NAME>_FOUND variables. Packages which are " "searched QUIET are not listed. A project can add its own features to " - "this list.This property is used by the macros in FeatureSummary.cmake."); + "this list. " + "This property is used by the macros in FeatureSummary.cmake."); cm->DefineProperty ("PACKAGES_FOUND", cmProperty::GLOBAL, "List of packages which were found during the CMake run.", diff --git a/Source/cmake.h b/Source/cmake.h index 31b1bb7..161e656 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -9,28 +9,6 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -// This class represents a cmake invocation. It is the top level class when -// running cmake. Most cmake based GUIS should primarily create an instance -// of this class and communicate with it. -// -// The basic process for a GUI is as follows: -// -// 1) Create a cmake instance -// 2) Set the Home & Start directories, generator, and cmake command. this -// can be done using the Set methods or by using SetArgs and passing in -// command line arguments. -// 3) Load the cache by calling LoadCache (duh) -// 4) if you are using command line arguments with -D or -C flags then -// call SetCacheArgs (or if for some other reason you want to modify the -// cache, do it now. -// 5) Finally call Configure -// 6) Let the user change values and go back to step 5 -// 7) call Generate -// -// If your GUI allows the user to change the start & home directories then -// you must at a minimum redo steps 2 through 7. -// - #ifndef cmake_h #define cmake_h @@ -53,6 +31,30 @@ class cmListFileBacktrace; class cmTarget; class cmGeneratedFileStream; +/** \brief Represents a cmake invocation. + * + * This class represents a cmake invocation. It is the top level class when + * running cmake. Most cmake based GUIS should primarily create an instance + * of this class and communicate with it. + * + * The basic process for a GUI is as follows: + * + * -# Create a cmake instance + * -# Set the Home & Start directories, generator, and cmake command. this + * can be done using the Set methods or by using SetArgs and passing in + * command line arguments. + * -# Load the cache by calling LoadCache (duh) + * -# if you are using command line arguments with -D or -C flags then + * call SetCacheArgs (or if for some other reason you want to modify the + * cache), do it now. + * -# Finally call Configure + * -# Let the user change values and go back to step 5 + * -# call Generate + + * If your GUI allows the user to change the start & home directories then + * you must at a minimum redo steps 2 through 7. + */ + class cmake { public: @@ -66,31 +68,33 @@ class cmake }; - /** Describes the working modes of cmake. - * NORMAL_MODE: cmake runs to create project files - * SCRIPT_MODE: in script mode there is no generator and no cache. Also, - * language are not enabled, so add_executable and things do - * not do anything. Started by using -P - * FIND_PACKAGE_MODE: cmake runs in pkg-config like mode, i.e. it just - * searches for a package and prints the results to stdout. - * This is similar to SCRIPT_MODE, but commands like - * add_library() work too, since they may be used e.g. in - * exported target files. Started via --find-package - */ + /** \brief Describes the working modes of cmake */ enum WorkingMode { - NORMAL_MODE, + NORMAL_MODE, ///< Cmake runs to create project files + /** \brief Script mode (started by using -P). + * + * In script mode there is no generator and no cache. Also, + * languages are not enabled, so add_executable and things do + * nothing. + */ SCRIPT_MODE, + /** \brief A pkg-config like mode + * + * In this mode cmake just searches for a package and prints the results to + * stdout. This is similar to SCRIPT_MODE, but commands like add_library() + * work too, since they may be used e.g. in exported target files. Started + * via --find-package. + */ FIND_PACKAGE_MODE }; typedef std::map<cmStdString, cmCommand*> RegisteredCommandsMap; - ///! construct an instance of cmake + /// Default constructor cmake(); - ///! destruct an instance of cmake + /// Destructor ~cmake(); - ///! construct an instance of cmake static const char *GetCMakeFilesDirectory() {return "/CMakeFiles";}; static const char *GetCMakeFilesDirectoryPostSlash() { return "CMakeFiles/";}; @@ -164,12 +168,6 @@ class cmake int Configure(); int ActualConfigure(); - /** - * Configure the cmMakefiles. This routine will create a GlobalGenerator if - * one has not already been set. It will then Call Configure on the - * GlobalGenerator. This in turn will read in an process all the CMakeList - * files for the tree. It will not produce any actual Makefiles, or - * workspaces. Generate does that. */ int LoadCache(); void PreLoadCMakeFiles(); diff --git a/Source/cmakexbuild.cxx b/Source/cmakexbuild.cxx index 89d0ec5..8eaae47 100644 --- a/Source/cmakexbuild.cxx +++ b/Source/cmakexbuild.cxx @@ -15,7 +15,7 @@ // This is a wrapper program for xcodebuild // it calls xcodebuild, and does two things -// it removes much of the output, all the setevn +// it removes much of the output, all the setenv // stuff. Also, it checks for the text file busy // error, and re-runs xcodebuild until that error does // not show up. diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index baf15ad..b00f782 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -15,7 +15,7 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) # KWSys version date month component. Format is MM. -SET(KWSYS_DATE_STAMP_MONTH 02) +SET(KWSYS_DATE_STAMP_MONTH 03) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 22) +SET(KWSYS_DATE_STAMP_DAY 09) |