ENH: unify EnableLanguage across all generators
This commit is contained in:
parent
8d20322160
commit
96189f79d5
|
@ -1,5 +1,14 @@
|
|||
# Nothing here yet
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
|
||||
INCLUDE(${CMAKE_ROOT}/Modules/CMakeVS7BackwardCompatibility.cmake)
|
||||
SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
|
||||
INCLUDE(${CMAKE_ROOT}/Modules/CMakeVS6BackwardCompatibility.cmake)
|
||||
SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
|
||||
|
||||
IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckSizeOf.cmake)
|
||||
CHECK_TYPE_SIZE(int CMAKE_SIZEOF_INT)
|
||||
CHECK_TYPE_SIZE(long CMAKE_SIZEOF_LONG)
|
||||
|
@ -41,6 +50,7 @@ SET (CMAKE_HP_PTHREADS ${CMAKE_HP_PTHREADS_INIT} CACHE BOOL
|
|||
|
||||
SET (CMAKE_USE_SPROC ${CMAKE_USE_SPROC_INIT} CACHE BOOL
|
||||
"Use sproc libs.")
|
||||
ENDIF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
CMAKE_THREAD_LIBS
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
|
||||
IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
|
||||
# check for some ANSI flags in the CXX compiler if it is not gnu
|
||||
IF(NOT CMAKE_COMPILER_IS_GNUCXX)
|
||||
INCLUDE(${CMAKE_ROOT}/Modules/TestCXXAcceptsFlag.cmake)
|
||||
|
@ -32,3 +32,4 @@ IF(NOT CMAKE_HAS_ANSI_STRING_STREAM)
|
|||
SET( CMAKE_NO_ANSI_STRING_STREAM 1 CACHE INTERNAL
|
||||
"Does the compiler support sstream or stringstream.")
|
||||
ENDIF(NOT CMAKE_HAS_ANSI_STRING_STREAM)
|
||||
ENDIF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
|
||||
|
|
|
@ -144,10 +144,6 @@ IF(CMAKE_USER_MAKE_RULES_OVERRIDE)
|
|||
ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE)
|
||||
|
||||
SET(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only.")
|
||||
# default build type is none
|
||||
SET (CMAKE_BUILD_TYPE "" CACHE STRING
|
||||
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
||||
|
||||
|
||||
SET (CMAKE_INSTALL_PREFIX /usr/local CACHE PATH
|
||||
"Install path prefix, prepended onto install directories.")
|
||||
|
@ -158,6 +154,20 @@ SET (CMAKE_INSTALL_PREFIX /usr/local CACHE PATH
|
|||
# and you can set these flags in the cmake cache
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_ENV_INIT} $ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during all build types.")
|
||||
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_ENV_INIT} $ENV{CFLAGS} ${CMAKE_C_FLAGS_INIT}" CACHE STRING
|
||||
"Flags for C compiler.")
|
||||
|
||||
SET (CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS_INIT}
|
||||
CACHE STRING "Flags used by the linker.")
|
||||
|
||||
IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
|
||||
# default build type is none
|
||||
IF(NOT CMAKE_NO_BUILD_TYPE)
|
||||
SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
|
||||
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
||||
ENDIF(NOT CMAKE_NO_BUILD_TYPE)
|
||||
|
||||
SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during debug builds.")
|
||||
SET (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT}" CACHE STRING
|
||||
|
@ -166,8 +176,6 @@ SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_INIT}" CACHE STRING
|
|||
"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
|
||||
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during Release with Debug Info builds.")
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_ENV_INIT} $ENV{CFLAGS} ${CMAKE_C_FLAGS_INIT}" CACHE STRING
|
||||
"Flags for C compiler.")
|
||||
SET (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during debug builds.")
|
||||
SET (CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL_INIT}" CACHE STRING
|
||||
|
@ -177,9 +185,6 @@ SET (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE_INIT}" CACHE STRING
|
|||
SET (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during Release with Debug Info builds.")
|
||||
|
||||
SET (CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS_INIT}
|
||||
CACHE STRING "Flags used by the linker.")
|
||||
|
||||
SET (CMAKE_EXE_LINKER_FLAGS_DEBUG ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
|
||||
"Flags used by the linker during debug builds.")
|
||||
|
||||
|
@ -193,10 +198,6 @@ SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
|
|||
${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
|
||||
"Flags used by the linker during Release with Debug Info builds.")
|
||||
|
||||
# shared linker flags
|
||||
SET (CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS_INIT}
|
||||
CACHE STRING "Flags used by the linker.")
|
||||
|
||||
SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
|
||||
"Flags used by the linker during debug builds.")
|
||||
|
||||
|
@ -211,10 +212,6 @@ SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
|
|||
${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
|
||||
"Flags used by the linker during Release with Debug Info builds.")
|
||||
|
||||
# module linker flags
|
||||
SET (CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS_INIT}
|
||||
CACHE STRING "Flags used by the linker.")
|
||||
|
||||
SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG ${CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
|
||||
"Flags used by the linker during debug builds.")
|
||||
|
||||
|
@ -228,6 +225,17 @@ SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE ${CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT}
|
|||
SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
|
||||
${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
|
||||
"Flags used by the linker during Release with Debug Info builds.")
|
||||
ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
|
||||
|
||||
|
||||
|
||||
# shared linker flags
|
||||
SET (CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS_INIT}
|
||||
CACHE STRING "Flags used by the linker.")
|
||||
|
||||
# module linker flags
|
||||
SET (CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS_INIT}
|
||||
CACHE STRING "Flags used by the linker.")
|
||||
|
||||
SET(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM} CACHE INTERNAL
|
||||
"What is the target build tool cmake is generating for.")
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
# hard code these for fast backwards compatibility tests
|
||||
SET (CMAKE_SIZEOF_INT 4 CACHE INTERNAL "Size of int data type")
|
||||
SET (CMAKE_SIZEOF_LONG 4 CACHE INTERNAL "Size of long data type")
|
||||
SET (CMAKE_SIZEOF_VOID_P 4 CACHE INTERNAL "Size of void* data type")
|
||||
SET (CMAKE_SIZEOF_CHAR 1 CACHE INTERNAL "Size of char data type")
|
||||
SET (CMAKE_SIZEOF_SHORT 2 CACHE INTERNAL "Size of short data type")
|
||||
SET (CMAKE_SIZEOF_FLOAT 4 CACHE INTERNAL "Size of float data type")
|
||||
SET (CMAKE_SIZEOF_DOUBLE 8 CACHE INTERNAL "Size of double data type")
|
||||
SET (CMAKE_NO_ANSI_FOR_SCOPE 1 CACHE INTERNAL
|
||||
"Does the compiler support ansi for scope.")
|
|
@ -0,0 +1,9 @@
|
|||
FIND_PROGRAM(CMAKE_MAKE_PROGRAM
|
||||
NAMES msdev
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\6.0\\Setup;VsCommonDir]/MSDev98/Bin/msdev
|
||||
"c:/Program Files/Microsoft Visual Studio/Common/MSDev98/Bin"
|
||||
"c:/Program Files/Microsoft Visual Studio/Common/MSDev98/Bin"
|
||||
"/Program Files/Microsoft Visual Studio/Common/MSDev98/Bin"
|
||||
)
|
||||
MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)
|
|
@ -0,0 +1,10 @@
|
|||
# hard code these for fast backwards compatibility tests
|
||||
SET (CMAKE_SIZEOF_INT 4 CACHE INTERNAL "Size of int data type")
|
||||
SET (CMAKE_SIZEOF_LONG 4 CACHE INTERNAL "Size of long data type")
|
||||
SET (CMAKE_SIZEOF_VOID_P 4 CACHE INTERNAL "Size of void* data type")
|
||||
SET (CMAKE_SIZEOF_CHAR 1 CACHE INTERNAL "Size of char data type")
|
||||
SET (CMAKE_SIZEOF_SHORT 2 CACHE INTERNAL "Size of short data type")
|
||||
SET (CMAKE_SIZEOF_FLOAT 4 CACHE INTERNAL "Size of float data type")
|
||||
SET (CMAKE_SIZEOF_DOUBLE 8 CACHE INTERNAL "Size of double data type")
|
||||
SET (CMAKE_NO_ANSI_FOR_SCOPE 0 CACHE INTERNAL
|
||||
"Does the compiler support ansi for scope.")
|
|
@ -0,0 +1,9 @@
|
|||
FIND_PROGRAM(CMAKE_MAKE_PROGRAM
|
||||
NAMES devenv
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.0\\Setup\\VS;EnvironmentDirectory]
|
||||
"c:/Program Files/Microsoft Visual Studio .NET/Common7/IDE"
|
||||
"c:/Program Files/Microsoft Visual Studio.NET/Common7/IDE"
|
||||
"/Program Files/Microsoft Visual Studio .NET/Common7/IDE/"
|
||||
)
|
||||
MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)
|
|
@ -107,7 +107,7 @@ IF(BUILD_TESTING)
|
|||
|
||||
# for non IDE based builds nmake and make
|
||||
# add all these extra targets
|
||||
IF(${CMAKE_BUILD_TOOL} MATCHES make)
|
||||
IF(${CMAKE_MAKE_PROGRAM} MATCHES make)
|
||||
# Make targets for Experimental builds
|
||||
ADD_CUSTOM_TARGET(ExperimentalStart
|
||||
${TCL_TCLSH} ${DART_ROOT}/Source/Client/DashboardManager.tcl ${PROJECT_BINARY_DIR}/DartConfiguration.tcl Experimental Start)
|
||||
|
@ -161,7 +161,7 @@ IF(BUILD_TESTING)
|
|||
${TCL_TCLSH} ${DART_ROOT}/Source/Client/DashboardManager.tcl ${PROJECT_BINARY_DIR}/DartConfiguration.tcl Nightly DashboardStart)
|
||||
ADD_CUSTOM_TARGET(NightlyDashboardEnd
|
||||
${TCL_TCLSH} ${DART_ROOT}/Source/Client/DashboardManager.tcl ${PROJECT_BINARY_DIR}/DartConfiguration.tcl Nightly DashboardEnd)
|
||||
ENDIF (${CMAKE_BUILD_TOOL} MATCHES make)
|
||||
ENDIF (${CMAKE_MAKE_PROGRAM} MATCHES make)
|
||||
|
||||
ELSE(TCL_TCLSH)
|
||||
MESSAGE("Could not find TCL_TCLSH, disabling testing." "Error")
|
||||
|
|
|
@ -44,11 +44,9 @@ SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
|
|||
SET(CMAKE_CXX_LINK_EXECUTABLE
|
||||
"<CMAKE_CXX_COMPILER> /nologo ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /Fe<TARGET> -link <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
|
||||
|
||||
SET (CMAKE_BUILD_TYPE Debug CACHE STRING
|
||||
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.")
|
||||
|
||||
SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows)
|
||||
|
||||
# default to Debug builds
|
||||
SET(CMAKE_BUILD_TYPE_INIT Debug)
|
||||
SET (CMAKE_CXX_FLAGS_INIT "/W3 /Zm1000 /GX /GR")
|
||||
SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/MDd /Zi /Od /GZ")
|
||||
SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1")
|
||||
|
@ -65,6 +63,21 @@ SET (CMAKE_STANDARD_LIBRARIES "kernel32.lib user32.lib gdi32.lib winspool.lib co
|
|||
"Libraries linked by defalut with all applications.")
|
||||
MARK_AS_ADVANCED(CMAKE_STANDARD_LIBRARIES)
|
||||
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
|
||||
SET (CMAKE_NO_BUILD_TYPE 1)
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
|
||||
SET (CMAKE_CONFIGURATION_TYPES "Debug Release MinSizeRel RelWithDebInfo" CACHE STRING
|
||||
"Space separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.")
|
||||
SET (CMAKE_CXX_WARNING_LEVEL "3" CACHE STRING
|
||||
"Size of stack for programs.")
|
||||
SET (CMAKE_CXX_STACK_SIZE "10000000" CACHE STRING
|
||||
"Size of stack for programs.")
|
||||
MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES CMAKE_CXX_STACK_SIZE CMAKE_CXX_WARNING_LEVEL)
|
||||
SET (CMAKE_NOT_USING_CONFIG_FLAGS 1)
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
|
||||
|
||||
|
||||
# executable linker flags
|
||||
SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
|
||||
SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:I386 /INCREMENTAL:YES")
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
#include "cmLocalUnixMakefileGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmake.h"
|
||||
cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator()
|
||||
{
|
||||
m_FindMakeProgramFile = "CMakeBorlandFindMake.cmake";
|
||||
}
|
||||
|
||||
void cmGlobalBorlandMakefileGenerator::EnableLanguage(const char* l,
|
||||
cmMakefile *mf)
|
||||
|
@ -40,13 +44,6 @@ void cmGlobalBorlandMakefileGenerator::EnableLanguage(const char* l,
|
|||
mf->AddDefinition("BORLAND", "1");
|
||||
mf->AddDefinition("CMAKE_GENERATOR_CC", "bcc32");
|
||||
mf->AddDefinition("CMAKE_GENERATOR_CXX", "bcc32");
|
||||
if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
|
||||
|| cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
|
||||
{
|
||||
std::string setMakeProgram = mf->GetDefinition("CMAKE_ROOT");
|
||||
setMakeProgram += "/Modules/CMakeBorlandFindMake.cmake";
|
||||
mf->ReadListFile(0, setMakeProgram.c_str());
|
||||
}
|
||||
this->cmGlobalUnixMakefileGenerator::EnableLanguage(l, mf);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
class cmGlobalBorlandMakefileGenerator : public cmGlobalNMakeMakefileGenerator
|
||||
{
|
||||
public:
|
||||
cmGlobalBorlandMakefileGenerator();
|
||||
///! Get the name for the generator.
|
||||
virtual const char* GetName() {
|
||||
return cmGlobalBorlandMakefileGenerator::GetActualName();}
|
||||
|
|
|
@ -34,6 +34,155 @@ cmGlobalGenerator::~cmGlobalGenerator()
|
|||
m_LocalGenerators.clear();
|
||||
}
|
||||
|
||||
|
||||
void cmGlobalGenerator::EnableLanguage(const char* lang,
|
||||
cmMakefile *mf)
|
||||
{
|
||||
if(m_FindMakeProgramFile.size() == 0)
|
||||
{
|
||||
cmSystemTools::Error(
|
||||
"Generator implementation error, "
|
||||
"all generators must specify m_FindMakeProgramFile");
|
||||
}
|
||||
std::string root = mf->GetDefinition("CMAKE_ROOT");
|
||||
if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
|
||||
|| cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
|
||||
{
|
||||
std::string setMakeProgram = root;
|
||||
setMakeProgram += "/Modules/";
|
||||
setMakeProgram += m_FindMakeProgramFile;
|
||||
mf->ReadListFile(0, setMakeProgram.c_str());
|
||||
}
|
||||
if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
|
||||
|| cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
|
||||
{
|
||||
cmSystemTools::Error("EnableLanguage was unable to find a CMAKE_MAKE_PROGRAM");
|
||||
return;
|
||||
}
|
||||
std::string makeProgram = mf->GetDefinition("CMAKE_MAKE_PROGRAM");
|
||||
if(makeProgram.find(' ') != makeProgram.npos)
|
||||
{
|
||||
cmSystemTools::GetShortPath(makeProgram.c_str(), makeProgram);
|
||||
this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", makeProgram.c_str(),
|
||||
"make program",
|
||||
cmCacheManager::FILEPATH);
|
||||
}
|
||||
|
||||
bool isLocal = m_CMakeInstance->GetLocal();
|
||||
// if no lang specified use CXX
|
||||
if(!lang )
|
||||
{
|
||||
lang = "CXX";
|
||||
}
|
||||
std::string rootBin = mf->GetHomeOutputDirectory();
|
||||
if(m_ConfiguredFilesPath.size())
|
||||
{
|
||||
rootBin = m_ConfiguredFilesPath;
|
||||
}
|
||||
bool needCBackwards = false;
|
||||
bool needCXXBackwards = false;
|
||||
|
||||
// check for a C compiler and configure it
|
||||
if(!isLocal &&
|
||||
!this->GetLanguageEnabled("C") &&
|
||||
lang[0] == 'C')
|
||||
{
|
||||
if (m_CMakeInstance->GetIsInTryCompile())
|
||||
{
|
||||
cmSystemTools::Error("This should not have happen. "
|
||||
"If you see this message, you are probably using a "
|
||||
"broken CMakeLists.txt file or a problematic release of "
|
||||
"CMake");
|
||||
}
|
||||
needCBackwards = true;
|
||||
// Read the DetermineSystem file
|
||||
std::string systemFile = root;
|
||||
systemFile += "/Modules/CMakeDetermineSystem.cmake";
|
||||
mf->ReadListFile(0, systemFile.c_str());
|
||||
// read determine C compiler
|
||||
std::string determineCFile = root;
|
||||
determineCFile += "/Modules/CMakeDetermineCCompiler.cmake";
|
||||
mf->ReadListFile(0,determineCFile.c_str());
|
||||
this->SetLanguageEnabled("C");
|
||||
}
|
||||
|
||||
// check for a CXX compiler and configure it
|
||||
if(!isLocal &&
|
||||
!this->GetLanguageEnabled("CXX") &&
|
||||
strcmp(lang, "CXX") == 0)
|
||||
{
|
||||
needCXXBackwards = true;
|
||||
std::string determineCFile = root;
|
||||
determineCFile += "/Modules/CMakeDetermineCXXCompiler.cmake";
|
||||
mf->ReadListFile(0,determineCFile.c_str());
|
||||
this->SetLanguageEnabled("CXX");
|
||||
}
|
||||
|
||||
|
||||
std::string fpath = rootBin;
|
||||
if(!mf->GetDefinition("CMAKE_SYSTEM_LOADED"))
|
||||
{
|
||||
fpath += "/CMakeSystem.cmake";
|
||||
mf->ReadListFile(0,fpath.c_str());
|
||||
}
|
||||
// if C, then enable C
|
||||
if(lang[0] == 'C' && !mf->GetDefinition("CMAKE_C_COMPILER_LOADED"))
|
||||
{
|
||||
fpath = rootBin;
|
||||
fpath += "/CMakeCCompiler.cmake";
|
||||
mf->ReadListFile(0,fpath.c_str());
|
||||
}
|
||||
if(strcmp(lang, "CXX") == 0 && !mf->GetDefinition("CMAKE_CXX_COMPILER_LOADED"))
|
||||
{
|
||||
fpath = rootBin;
|
||||
fpath += "/CMakeCXXCompiler.cmake";
|
||||
mf->ReadListFile(0,fpath.c_str());
|
||||
}
|
||||
if(!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED"))
|
||||
{
|
||||
fpath = root;
|
||||
fpath += "/Modules/CMakeSystemSpecificInformation.cmake";
|
||||
mf->ReadListFile(0,fpath.c_str());
|
||||
}
|
||||
|
||||
if(!isLocal)
|
||||
{
|
||||
// At this point we should have enough info for a try compile
|
||||
// which is used in the backward stuff
|
||||
if(needCBackwards)
|
||||
{
|
||||
if (!m_CMakeInstance->GetIsInTryCompile())
|
||||
{
|
||||
// for old versions of CMake ListFiles
|
||||
const char* versionValue
|
||||
= mf->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
|
||||
if (!versionValue || atof(versionValue) <= 1.4)
|
||||
{
|
||||
std::string ifpath = root + "/Modules/CMakeBackwardCompatibilityC.cmake";
|
||||
mf->ReadListFile(0,ifpath.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(needCXXBackwards)
|
||||
{
|
||||
if (!m_CMakeInstance->GetIsInTryCompile())
|
||||
{
|
||||
// for old versions of CMake ListFiles
|
||||
const char* versionValue
|
||||
= mf->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
|
||||
if (!versionValue || atof(versionValue) <= 1.4)
|
||||
{
|
||||
std::string fpath = root + "/Modules/CMakeBackwardCompatibilityCXX.cmake";
|
||||
mf->ReadListFile(0,fpath.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
// if we are from the top, always define this
|
||||
mf->AddDefinition("RUN_CONFIGURE", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void cmGlobalGenerator::SetLanguageEnabled(const char* l)
|
||||
{
|
||||
m_LanguageEnabled[l] = true;
|
||||
|
@ -215,19 +364,23 @@ cmLocalGenerator *cmGlobalGenerator::CreateLocalGenerator()
|
|||
|
||||
void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen )
|
||||
{
|
||||
// create a temp generator
|
||||
cmLocalGenerator *lg = this->CreateLocalGenerator();
|
||||
lg->GetMakefile()->SetStartDirectory(m_CMakeInstance->GetStartDirectory());
|
||||
lg->GetMakefile()->SetStartOutputDirectory(m_CMakeInstance->GetStartOutputDirectory());
|
||||
lg->GetMakefile()->MakeStartDirectoriesCurrent();
|
||||
|
||||
// for each existing language call enable Language
|
||||
std::map<cmStdString, bool>::const_iterator i =
|
||||
gen->m_LanguageEnabled.begin();
|
||||
for (;i != gen->m_LanguageEnabled.end(); ++i)
|
||||
this->SetConfiguredFilesPath(
|
||||
gen->GetCMakeInstance()->GetHomeOutputDirectory());
|
||||
const char* make =
|
||||
gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
|
||||
this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", make,
|
||||
"make program",
|
||||
cmCacheManager::FILEPATH);
|
||||
// if C, then enable C
|
||||
if(gen->GetLanguageEnabled("C"))
|
||||
{
|
||||
this->EnableLanguage(i->first.c_str(),lg->GetMakefile());
|
||||
}
|
||||
delete lg;
|
||||
this->SetLanguageEnabled("C");
|
||||
}
|
||||
|
||||
// if CXX
|
||||
if(gen->GetLanguageEnabled("CXX"))
|
||||
{
|
||||
this->SetLanguageEnabled("CXX");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
* Try to determine system infomation such as shared library
|
||||
* extension, pthreads, byte order etc.
|
||||
*/
|
||||
virtual void EnableLanguage(const char*, cmMakefile *) {};
|
||||
virtual void EnableLanguage(const char*, cmMakefile *);
|
||||
|
||||
/**
|
||||
* Try to determine system infomation, get it from another generator
|
||||
|
@ -99,6 +99,7 @@ public:
|
|||
|
||||
void SetConfiguredFilesPath(const char* s){m_ConfiguredFilesPath = s;}
|
||||
protected:
|
||||
cmStdString m_FindMakeProgramFile;
|
||||
cmStdString m_ConfiguredFilesPath;
|
||||
cmake *m_CMakeInstance;
|
||||
std::vector<cmLocalGenerator *> m_LocalGenerators;
|
||||
|
|
|
@ -18,21 +18,18 @@
|
|||
#include "cmLocalUnixMakefileGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
|
||||
|
||||
cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator()
|
||||
{
|
||||
m_FindMakeProgramFile = "CMakeNMakeFindMake.cmake";
|
||||
}
|
||||
|
||||
void cmGlobalNMakeMakefileGenerator::EnableLanguage(const char* l,
|
||||
cmMakefile *mf)
|
||||
{
|
||||
// pick a default
|
||||
mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
|
||||
mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
|
||||
if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
|
||||
|| cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
|
||||
{
|
||||
std::string setMakeProgram = mf->GetDefinition("CMAKE_ROOT");
|
||||
setMakeProgram += "/Modules/CMakeNMakeFindMake.cmake";
|
||||
mf->ReadListFile(0, setMakeProgram.c_str());
|
||||
}
|
||||
|
||||
|
||||
this->cmGlobalUnixMakefileGenerator::EnableLanguage(l, mf);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
class cmGlobalNMakeMakefileGenerator : public cmGlobalUnixMakefileGenerator
|
||||
{
|
||||
public:
|
||||
cmGlobalNMakeMakefileGenerator();
|
||||
///! Get the name for the generator.
|
||||
virtual const char* GetName() {
|
||||
return cmGlobalNMakeMakefileGenerator::GetActualName();}
|
||||
|
|
|
@ -20,130 +20,15 @@
|
|||
#include "cmMakefile.h"
|
||||
#include "cmake.h"
|
||||
|
||||
cmGlobalUnixMakefileGenerator::cmGlobalUnixMakefileGenerator()
|
||||
{
|
||||
m_FindMakeProgramFile = "CMakeUnixFindMake.cmake";
|
||||
}
|
||||
|
||||
void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
|
||||
cmMakefile *mf)
|
||||
{
|
||||
if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
|
||||
|| cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
|
||||
{
|
||||
std::string setMakeProgram = mf->GetDefinition("CMAKE_ROOT");
|
||||
setMakeProgram += "/Modules/CMakeUnixFindMake.cmake";
|
||||
mf->ReadListFile(0, setMakeProgram.c_str());
|
||||
}
|
||||
|
||||
bool isLocal = m_CMakeInstance->GetLocal();
|
||||
// if no lang specified use CXX
|
||||
if(!lang )
|
||||
{
|
||||
lang = "CXX";
|
||||
}
|
||||
std::string root = mf->GetDefinition("CMAKE_ROOT");
|
||||
std::string rootBin = mf->GetHomeOutputDirectory();
|
||||
if(m_ConfiguredFilesPath.size())
|
||||
{
|
||||
rootBin = m_ConfiguredFilesPath;
|
||||
}
|
||||
bool needCBackwards = false;
|
||||
bool needCXXBackwards = false;
|
||||
|
||||
// check for a C compiler and configure it
|
||||
if(!isLocal &&
|
||||
!this->GetLanguageEnabled("C") &&
|
||||
lang[0] == 'C')
|
||||
{
|
||||
if (m_CMakeInstance->GetIsInTryCompile())
|
||||
{
|
||||
cmSystemTools::Error("This should not have happen. "
|
||||
"If you see this message, you are probably using a "
|
||||
"broken CMakeLists.txt file or a problematic release of "
|
||||
"CMake");
|
||||
}
|
||||
needCBackwards = true;
|
||||
// Read the DetermineSystem file
|
||||
std::string systemFile = root;
|
||||
systemFile += "/Modules/CMakeDetermineSystem.cmake";
|
||||
mf->ReadListFile(0, systemFile.c_str());
|
||||
// read determine C compiler
|
||||
std::string determineCFile = root;
|
||||
determineCFile += "/Modules/CMakeDetermineCCompiler.cmake";
|
||||
mf->ReadListFile(0,determineCFile.c_str());
|
||||
this->SetLanguageEnabled("C");
|
||||
}
|
||||
|
||||
// check for a CXX compiler and configure it
|
||||
if(!isLocal &&
|
||||
!this->GetLanguageEnabled("CXX") &&
|
||||
strcmp(lang, "CXX") == 0)
|
||||
{
|
||||
needCXXBackwards = true;
|
||||
std::string determineCFile = root;
|
||||
determineCFile += "/Modules/CMakeDetermineCXXCompiler.cmake";
|
||||
mf->ReadListFile(0,determineCFile.c_str());
|
||||
this->SetLanguageEnabled("CXX");
|
||||
}
|
||||
|
||||
|
||||
std::string fpath = rootBin;
|
||||
if(!mf->GetDefinition("CMAKE_SYSTEM_LOADED"))
|
||||
{
|
||||
fpath += "/CMakeSystem.cmake";
|
||||
mf->ReadListFile(0,fpath.c_str());
|
||||
}
|
||||
// if C, then enable C
|
||||
if(lang[0] == 'C' && !mf->GetDefinition("CMAKE_C_COMPILER_LOADED"))
|
||||
{
|
||||
fpath = rootBin;
|
||||
fpath += "/CMakeCCompiler.cmake";
|
||||
mf->ReadListFile(0,fpath.c_str());
|
||||
}
|
||||
if(strcmp(lang, "CXX") == 0 && !mf->GetDefinition("CMAKE_CXX_COMPILER_LOADED"))
|
||||
{
|
||||
fpath = rootBin;
|
||||
fpath += "/CMakeCXXCompiler.cmake";
|
||||
mf->ReadListFile(0,fpath.c_str());
|
||||
}
|
||||
if(!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED"))
|
||||
{
|
||||
fpath = root;
|
||||
fpath += "/Modules/CMakeSystemSpecificInformation.cmake";
|
||||
mf->ReadListFile(0,fpath.c_str());
|
||||
}
|
||||
|
||||
if(!isLocal)
|
||||
{
|
||||
// At this point we should have enough info for a try compile
|
||||
// which is used in the backward stuff
|
||||
if(needCBackwards)
|
||||
{
|
||||
if (!m_CMakeInstance->GetIsInTryCompile())
|
||||
{
|
||||
// for old versions of CMake ListFiles
|
||||
const char* versionValue
|
||||
= mf->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
|
||||
if (!versionValue || atof(versionValue) <= 1.4)
|
||||
{
|
||||
std::string ifpath = root + "/Modules/CMakeBackwardCompatibilityC.cmake";
|
||||
mf->ReadListFile(0,ifpath.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(needCXXBackwards)
|
||||
{
|
||||
if (!m_CMakeInstance->GetIsInTryCompile())
|
||||
{
|
||||
// for old versions of CMake ListFiles
|
||||
const char* versionValue
|
||||
= mf->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
|
||||
if (!versionValue || atof(versionValue) <= 1.4)
|
||||
{
|
||||
std::string fpath = root + "/Modules/CMakeBackwardCompatibilityCXX.cmake";
|
||||
mf->ReadListFile(0,fpath.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
// if we are from the top, always define this
|
||||
mf->AddDefinition("RUN_CONFIGURE", true);
|
||||
}
|
||||
this->cmGlobalGenerator::EnableLanguage(lang, mf);
|
||||
}
|
||||
|
||||
///! Create a local generator appropriate to this Global Generator
|
||||
|
@ -154,24 +39,3 @@ cmLocalGenerator *cmGlobalUnixMakefileGenerator::CreateLocalGenerator()
|
|||
return lg;
|
||||
}
|
||||
|
||||
void cmGlobalUnixMakefileGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen)
|
||||
{
|
||||
this->SetConfiguredFilesPath(
|
||||
gen->GetCMakeInstance()->GetHomeOutputDirectory());
|
||||
const char* make =
|
||||
gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
|
||||
this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", make,
|
||||
"make program",
|
||||
cmCacheManager::FILEPATH);
|
||||
// if C, then enable C
|
||||
if(gen->GetLanguageEnabled("C"))
|
||||
{
|
||||
this->SetLanguageEnabled("C");
|
||||
}
|
||||
|
||||
// if CXX
|
||||
if(gen->GetLanguageEnabled("CXX"))
|
||||
{
|
||||
this->SetLanguageEnabled("CXX");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
class cmGlobalUnixMakefileGenerator : public cmGlobalGenerator
|
||||
{
|
||||
public:
|
||||
cmGlobalUnixMakefileGenerator();
|
||||
///! Get the name for the generator.
|
||||
virtual const char* GetName() {
|
||||
return cmGlobalUnixMakefileGenerator::GetActualName();}
|
||||
|
@ -41,11 +42,6 @@ public:
|
|||
*/
|
||||
virtual void EnableLanguage(const char*, cmMakefile *mf);
|
||||
|
||||
/**
|
||||
* Try to determine system infomation, get it from another generator
|
||||
*/
|
||||
virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,24 +19,15 @@
|
|||
#include "cmMakefile.h"
|
||||
#include "cmake.h"
|
||||
|
||||
void cmGlobalVisualStudio6Generator::EnableLanguage(const char*,
|
||||
cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator()
|
||||
{
|
||||
m_FindMakeProgramFile = "CMakeVS6FindMake.cmake";
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio6Generator::EnableLanguage(const char* lang,
|
||||
cmMakefile *mf)
|
||||
{
|
||||
// now load the settings
|
||||
if(!mf->GetDefinition("CMAKE_ROOT"))
|
||||
{
|
||||
cmSystemTools::Error(
|
||||
"CMAKE_ROOT has not been defined, bad GUI or driver program");
|
||||
return;
|
||||
}
|
||||
if(!this->GetLanguageEnabled("CXX"))
|
||||
{
|
||||
std::string fpath =
|
||||
mf->GetDefinition("CMAKE_ROOT");
|
||||
fpath += "/Templates/CMakeWindowsSystemConfig.cmake";
|
||||
mf->ReadListFile(NULL,fpath.c_str());
|
||||
this->SetLanguageEnabled("CXX");
|
||||
}
|
||||
this->cmGlobalGenerator::EnableLanguage(lang, mf);
|
||||
}
|
||||
|
||||
int cmGlobalVisualStudio6Generator::TryCompile(const char *,
|
||||
|
@ -63,7 +54,6 @@ int cmGlobalVisualStudio6Generator::TryCompile(const char *,
|
|||
*/
|
||||
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
|
||||
cmSystemTools::ChangeDirectory(bindir);
|
||||
|
||||
// if there are spaces in the makeCommand, assume a full path
|
||||
// and convert it to a path with no spaces in it as the
|
||||
// RunCommand does not like spaces
|
||||
|
@ -85,7 +75,6 @@ int cmGlobalVisualStudio6Generator::TryCompile(const char *,
|
|||
makeCommand += "ALL_BUILD";
|
||||
}
|
||||
makeCommand += " - Debug\"";
|
||||
|
||||
int retVal;
|
||||
if (!cmSystemTools::RunCommand(makeCommand.c_str(), *output, retVal, 0, false))
|
||||
{
|
||||
|
|
|
@ -29,6 +29,8 @@ class cmTarget;
|
|||
class cmGlobalVisualStudio6Generator : public cmGlobalGenerator
|
||||
{
|
||||
public:
|
||||
cmGlobalVisualStudio6Generator();
|
||||
|
||||
///! Get the name for the generator.
|
||||
virtual const char* GetName() {
|
||||
return cmGlobalVisualStudio6Generator::GetActualName();}
|
||||
|
|
|
@ -20,26 +20,23 @@
|
|||
#include "cmake.h"
|
||||
#include "windows.h"
|
||||
|
||||
void cmGlobalVisualStudio7Generator::EnableLanguage(const char*,
|
||||
|
||||
cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator()
|
||||
{
|
||||
m_FindMakeProgramFile = "CMakeVS7FindMake.cmake";
|
||||
}
|
||||
|
||||
|
||||
void cmGlobalVisualStudio7Generator::EnableLanguage(const char* lang,
|
||||
cmMakefile *mf)
|
||||
{
|
||||
// now load the settings
|
||||
if(!mf->GetDefinition("CMAKE_ROOT"))
|
||||
{
|
||||
cmSystemTools::Error(
|
||||
"CMAKE_ROOT has not been defined, bad GUI or driver program");
|
||||
return;
|
||||
}
|
||||
if(!this->GetLanguageEnabled("CXX"))
|
||||
{
|
||||
std::string fpath =
|
||||
mf->GetDefinition("CMAKE_ROOT");
|
||||
fpath += "/Templates/CMakeDotNetSystemConfig.cmake";
|
||||
mf->ReadListFile(NULL,fpath.c_str());
|
||||
this->SetLanguageEnabled("CXX");
|
||||
}
|
||||
mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
|
||||
mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
|
||||
this->cmGlobalGenerator::EnableLanguage(lang, mf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int cmGlobalVisualStudio7Generator::TryCompile(const char *,
|
||||
const char *bindir,
|
||||
const char *projectName,
|
||||
|
|
|
@ -29,6 +29,7 @@ class cmTarget;
|
|||
class cmGlobalVisualStudio7Generator : public cmGlobalGenerator
|
||||
{
|
||||
public:
|
||||
cmGlobalVisualStudio7Generator();
|
||||
///! Get the name for the generator.
|
||||
virtual const char* GetName() {
|
||||
return cmGlobalVisualStudio7Generator::GetActualName();}
|
||||
|
|
|
@ -737,8 +737,16 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
|
|||
}
|
||||
}
|
||||
}
|
||||
std::string extraLinkOptions =
|
||||
m_Makefile->GetDefinition("CMAKE_EXTRA_LINK_FLAGS");
|
||||
std::string extraLinkOptions;
|
||||
if(target.GetType() == cmTarget::EXECUTABLE)
|
||||
{
|
||||
extraLinkOptions = m_Makefile->GetDefinition("CMAKE_EXE_LINKER_FLAGS");
|
||||
}
|
||||
if(target.GetType() == cmTarget::SHARED_LIBRARY)
|
||||
{
|
||||
extraLinkOptions = m_Makefile->GetDefinition("CMAKE_SHARED_LINKER_FLAGS");
|
||||
}
|
||||
|
||||
if(extraLinkOptions.size())
|
||||
{
|
||||
libOptions += " ";
|
||||
|
|
Loading…
Reference in New Issue