From f8261ff9f7085b8931da08a034569d81f87e83a5 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Tue, 26 Jun 2007 13:05:27 -0400 Subject: [PATCH] STYLE: change global cmake variable CMAKE_TARGET_SUPPORTS_ONLY_STATIC_LIBS to the first global cmake property TARGET_SUPPORTS_SHARED_LIBS Alex --- Modules/CMakeGenericSystem.cmake | 2 +- Modules/Platform/BlueGeneL.cmake | 2 +- Modules/Platform/Generic.cmake | 2 +- Source/cmAddLibraryCommand.cxx | 5 ++++- Source/cmake.cxx | 13 +++++++++++++ Source/cmake.h | 3 +++ 6 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 2af179d70..2b506229a 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -20,7 +20,7 @@ SET(CMAKE_FIND_LIBRARY_PREFIXES "lib") SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") # basically all general purpose OSs support shared libs -SET(CMAKE_TARGET_SUPPORTS_ONLY_STATIC_LIBS FALSE) +SET_PROPERTIES(GLOBAL PROPERTIES TARGET_SUPPORTS_SHARED_LIBS TRUE) SET (CMAKE_SKIP_RPATH "NO" CACHE BOOL "If set, runtime paths are not added when using shared libraries.") diff --git a/Modules/Platform/BlueGeneL.cmake b/Modules/Platform/BlueGeneL.cmake index a89988ada..5d9111b20 100644 --- a/Modules/Platform/BlueGeneL.cmake +++ b/Modules/Platform/BlueGeneL.cmake @@ -1,5 +1,5 @@ #the compute nodes on BlueGene/L don't support shared libs -SET(CMAKE_TARGET_SUPPORTS_ONLY_STATIC_LIBS TRUE) +SET_PROPERTIES(GLOBAL PROPERTIES TARGET_SUPPORTS_SHARED_LIBS FALSE) SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared diff --git a/Modules/Platform/Generic.cmake b/Modules/Platform/Generic.cmake index 9c78745ff..b6629e296 100644 --- a/Modules/Platform/Generic.cmake +++ b/Modules/Platform/Generic.cmake @@ -8,5 +8,5 @@ # and/or ${CMAKE_SYSTEM_NAME}--${CMAKE_SYSTEM_PROCESSOR}.cmake # (embedded) targets without operating system usually don't support shared libraries -SET(CMAKE_TARGET_SUPPORTS_ONLY_STATIC_LIBS TRUE) +SET_PROPERTIES(GLOBAL PROPERTIES TARGET_SUPPORTS_SHARED_LIBS FALSE) diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index cc55f8031..bbfa5ce7c 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -16,6 +16,8 @@ =========================================================================*/ #include "cmAddLibraryCommand.h" +#include "cmake.h" + // cmLibraryCommand bool cmAddLibraryCommand::InitialPass(std::vector const& args) { @@ -82,7 +84,8 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args) STATIC. But at this point we know only the name of the target, but not yet its linker language. */ if ((type != cmTarget::STATIC_LIBRARY) && - (this->Makefile->IsOn("CMAKE_TARGET_SUPPORTS_ONLY_STATIC_LIBS"))) + (this->Makefile->GetCMakeInstance()->GetPropertyAsBool( + "TARGET_SUPPORTS_SHARED_LIBS") == false)) { std::string msg = "ADD_LIBRARY for library "; msg += args[0]; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index bbd0fb280..b6efa1037 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -128,6 +128,7 @@ cmake::cmake() cmTarget::DefineProperties(this); cmMakefile::DefineProperties(this); cmTest::DefineProperties(this); + cmake::DefineProperties(this); #ifdef __APPLE__ struct rlimit rlp; @@ -2930,6 +2931,18 @@ int cmake::ExecuteLinkScript(std::vector& args) return result; } +void cmake::DefineProperties(cmake *cm) +{ + cm->DefineProperty + ("TARGET_SUPPORTS_SHARED_LIBS", cmProperty::GLOBAL, + "Does the target platform support shared libraries.", + "TARGET_SUPPORTS_SHARED_LIBS is a boolean specifying whether the target " + "platform supports shared libraries. Basically all current general " + "general purpose OS do so, the exception are usually embedded systems " + "with no or special OSs."); +} + + void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope, const char *ShortDescription, const char *FullDescription, diff --git a/Source/cmake.h b/Source/cmake.h index 8f6b283cc..f61cf9075 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -312,6 +312,9 @@ class cmake bool IsPropertyDefined(const char *name, cmProperty::ScopeType scope); bool IsPropertyChained(const char *name, cmProperty::ScopeType scope); + // Define the properties + static void DefineProperties(cmake *cm); + protected: cmPropertyMap Properties;