diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmAddExecutableCommand.cxx | 9 | ||||
-rw-r--r-- | Source/cmAddExecutableCommand.h | 7 | ||||
-rw-r--r-- | Source/cmAddLibraryCommand.cxx | 9 | ||||
-rw-r--r-- | Source/cmAddLibraryCommand.h | 7 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 10 | ||||
-rw-r--r-- | Source/cmMakefile.h | 6 |
6 files changed, 36 insertions, 12 deletions
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index d44fa9a..2fe544d 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -31,6 +31,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args) ++s; bool use_win32 = false; bool use_macbundle = false; + bool in_all = true; while ( s != args.end() ) { if (*s == "WIN32") @@ -43,6 +44,11 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args) ++s; use_macbundle = true; } + else if(*s == "NOT_IN_ALL") + { + ++s; + in_all = false; + } else { break; @@ -57,7 +63,8 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args) } std::vector<std::string> srclists(s, args.end()); - cmTarget* tgt = this->Makefile->AddExecutable(exename.c_str(), srclists); + cmTarget* tgt = this->Makefile->AddExecutable(exename.c_str(), srclists, + in_all); if ( use_win32 ) { tgt->SetProperty("WIN32_EXECUTABLE", "ON"); diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h index 77140c5..0ed838a 100644 --- a/Source/cmAddExecutableCommand.h +++ b/Source/cmAddExecutableCommand.h @@ -62,8 +62,8 @@ public: virtual const char* GetFullDocumentation() { return - " ADD_EXECUTABLE(exename [WIN32] [MACOSX_BUNDLE] source1\n" - " source2 ... sourceN)\n" + " ADD_EXECUTABLE(exename [WIN32] [MACOSX_BUNDLE] [NOT_IN_ALL]\n" + " source1 source2 ... sourceN)\n" "This command adds an executable target to the current directory. " "The executable will be built from the list of source files " "specified.\n" @@ -86,6 +86,9 @@ public: " MACOSX_BUNDLE_SHORT_VERSION_STRING\n" " MACOSX_BUNDLE_BUNDLE_VERSION\n" " MACOSX_BUNDLE_COPYRIGHT\n" + "If NOT_IN_ALL is given the target will not be built by default. " + "It will be built only if the user explicitly builds the target or " + "another target that requires the target depends on it." ; } diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index afcac0b..6b85d5f 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -28,6 +28,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args) // otherwise it defaults to static library. int shared = !cmSystemTools::IsOff(this->Makefile->GetDefinition("BUILD_SHARED_LIBS")); + bool in_all = true; std::vector<std::string>::const_iterator s = args.begin(); @@ -56,6 +57,11 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args) ++s; shared = 2; } + else if(*s == "NOT_IN_ALL") + { + ++s; + in_all = false; + } } if (s == args.end()) @@ -74,7 +80,8 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args) ++s; } - this->Makefile->AddLibrary(this->LibName.c_str(), shared, srclists); + this->Makefile->AddLibrary(this->LibName.c_str(), shared, srclists, + in_all); return true; } diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h index 86a9eb9..adb6246 100644 --- a/Source/cmAddLibraryCommand.h +++ b/Source/cmAddLibraryCommand.h @@ -61,7 +61,7 @@ public: virtual const char* GetFullDocumentation() { return - " ADD_LIBRARY(libname [SHARED | STATIC | MODULE]\n" + " ADD_LIBRARY(libname [SHARED | STATIC | MODULE] [NOT_IN_ALL]\n" " source1 source2 ... sourceN)\n" "Adds a library target. SHARED, STATIC or MODULE keywords are used " "to set the library type. If the keyword MODULE appears, the library " @@ -69,7 +69,10 @@ public: "without dyld, MODULE is treated like SHARED. If no keywords appear " " as the second argument, the type defaults to the current value of " "BUILD_SHARED_LIBS. If this variable is not set, the type defaults " - "to STATIC."; + "to STATIC.\n" + "If NOT_IN_ALL is given the target will not be built by default. " + "It will be built only if the user explicitly builds the target or " + "another target that requires the target depends on it."; } cmTypeMacro(cmAddLibraryCommand, cmCommand); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8799e52..29c3bde 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1281,7 +1281,8 @@ void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target) void cmMakefile::AddLibrary(const char* lname, int shared, - const std::vector<std::string> &srcs) + const std::vector<std::string> &srcs, + bool in_all) { cmTarget target; switch (shared) @@ -1303,7 +1304,7 @@ void cmMakefile::AddLibrary(const char* lname, int shared, // over changes in CMakeLists.txt, making the information stale and // hence useless. target.ClearDependencyInformation( *this, lname ); - target.SetInAll(true); + target.SetInAll(in_all); target.GetSourceLists() = srcs; target.SetMakefile(this); this->AddGlobalLinkInformation(lname, target); @@ -1313,11 +1314,12 @@ void cmMakefile::AddLibrary(const char* lname, int shared, } cmTarget* cmMakefile::AddExecutable(const char *exeName, - const std::vector<std::string> &srcs) + const std::vector<std::string> &srcs, + bool in_all) { cmTarget target; target.SetType(cmTarget::EXECUTABLE, exeName); - target.SetInAll(true); + target.SetInAll(in_all); target.GetSourceLists() = srcs; target.SetMakefile(this); this->AddGlobalLinkInformation(exeName, target); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 49071c4..5f3ff61 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -176,7 +176,8 @@ public: * Add an executable to the build. */ cmTarget* AddExecutable(const char *exename, - const std::vector<std::string> &srcs); + const std::vector<std::string> &srcs, + bool in_all = true); /** * Add a utility to the build. A utiltity target is a command that @@ -285,7 +286,8 @@ public: * Set the name of the library. */ void AddLibrary(const char *libname, int shared, - const std::vector<std::string> &srcs); + const std::vector<std::string> &srcs, + bool in_all = true); #if defined(CMAKE_BUILD_WITH_CMAKE) /** |