diff options
46 files changed, 463 insertions, 129 deletions
diff --git a/Help/release/dev/cmake-gui-select-toolset.rst b/Help/release/dev/cmake-gui-select-toolset.rst new file mode 100644 index 0000000..5186f91 --- /dev/null +++ b/Help/release/dev/cmake-gui-select-toolset.rst @@ -0,0 +1,6 @@ +cmake-gui-select-toolset +------------------------ + +* The :manual:`cmake-gui(1)` learned an option to set the toolset + to be used with VS IDE and Xcode generators, much like the + existing ``-T`` option to :manual:`cmake(1)`. diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index b224007..63f8787 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -55,6 +55,7 @@ int main(int argc, char* argv[]) #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; #endif + require += info_language_dialect_default[argc]; (void)argv; return require; } diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index d467507..61cd790 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -49,6 +49,7 @@ int main(int argc, char* argv[]) #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; #endif + require += info_language_dialect_default[argc]; (void)argv; return require; } diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake index 5908c26..1cc72c0 100644 --- a/Modules/Compiler/AppleClang-C.cmake +++ b/Modules/Compiler/AppleClang-C.cmake @@ -18,6 +18,9 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0) message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}") endif() set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + set(CMAKE_C_STANDARD_DEFAULT 99) endif() endif() diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake index c4e342b..95bc79a 100644 --- a/Modules/Compiler/AppleClang-CXX.cmake +++ b/Modules/Compiler/AppleClang-CXX.cmake @@ -28,6 +28,9 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") endif() set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + set(CMAKE_CXX_STANDARD_DEFAULT 98) endif() endif() diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index a2e81c1..d8b7743 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -23,6 +23,13 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}") endif() set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6) + set(CMAKE_C_STANDARD_DEFAULT 11) + else() + set(CMAKE_C_STANDARD_DEFAULT 99) + endif() endif() endif() diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 055a8ee..6a0a5e2 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -37,6 +37,9 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") endif() set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + set(CMAKE_CXX_STANDARD_DEFAULT 98) endif() endif() diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index d979fb7..2c478da 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -28,6 +28,13 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}") endif() set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) + set(CMAKE_C_STANDARD_DEFAULT 11) + else() + set(CMAKE_C_STANDARD_DEFAULT 90) + endif() endif() endif() diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index a7e71c3..e1c555b 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -40,6 +40,9 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") endif() set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + set(CMAKE_CXX_STANDARD_DEFAULT 98) endif() endif() diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index 50d68ee..b4a5591 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -42,6 +42,9 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") endif() set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + set(CMAKE_CXX_STANDARD_DEFAULT 98) endif() endif() diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index fccf877..eb7abfd 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -124,11 +124,11 @@ function(GTEST_ADD_TESTS executable extra_args) string(REGEX MATCH "${gtest_test_type_regex}" test_type ${hit}) # Parameterized tests have a different signature for the filter - if(${test_type} STREQUAL "TEST_P") + if("x${test_type}" STREQUAL "xTEST_P") string(REGEX REPLACE ${gtest_case_name_regex} "*/\\1.\\2/*" test_name ${hit}) - elseif(${test_type} STREQUAL "TEST_F" OR ${test_type} STREQUAL "TEST") + elseif("x${test_type}" STREQUAL "xTEST_F" OR "x${test_type}" STREQUAL "xTEST") string(REGEX REPLACE ${gtest_case_name_regex} "\\1.\\2" test_name ${hit}) - elseif(${test_type} STREQUAL "TYPED_TEST") + elseif("x${test_type}" STREQUAL "xTYPED_TEST") string(REGEX REPLACE ${gtest_case_name_regex} "\\1/*.\\2" test_name ${hit}) else() message(WARNING "Could not parse GTest ${hit} for adding to CTest.") diff --git a/Modules/Platform/CrayPrgEnv.cmake b/Modules/Platform/CrayPrgEnv.cmake index a78846d..d60266b 100644 --- a/Modules/Platform/CrayPrgEnv.cmake +++ b/Modules/Platform/CrayPrgEnv.cmake @@ -26,73 +26,53 @@ foreach(__lang C CXX Fortran) endforeach() # If the link type is not explicitly specified in the environment then -# the Cray wrappers assume that the code will be built staticly -if(NOT ((CMAKE_C_FLAGS MATCHES "(^| )-dynamic($| )") OR - (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )") OR - ("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic"))) +# the Cray wrappers assume that the code will be built staticly so +# we check the following condition(s) are NOT met +# Compiler flags are explicitly dynamic +# Env var is dynamic and compiler flags are not explicitly static +if(NOT (((CMAKE_C_FLAGS MATCHES "(^| )-dynamic($| )") OR + (CMAKE_CXX_FLAGS MATCHES "(^| )-dynamic($| )") OR + (CMAKE_Fortran_FLAGS MATCHES "(^| )-dynamic($| )") OR + (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )")) + OR + (("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") AND + NOT ((CMAKE_C_FLAGS MATCHES "(^| )-static($| )") OR + (CMAKE_CXX_FLAGS MATCHES "(^| )-static($| )") OR + (CMAKE_Fortran_FLAGS MATCHES "(^| )-static($| )") OR + (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-static($| )"))))) set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) set(BUILD_SHARED_LIBS FALSE CACHE BOOL "") set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") set(CMAKE_LINK_SEARCH_START_STATIC TRUE) endif() -# Parse the implicit directories used by the wrappers -get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES) -foreach(__lang IN LISTS __langs) - if(__lang STREQUAL "C") - set(__empty_fname empty.c) - elseif(__lang STREQUAL CXX) - set(__empty_fname empty.cxx) - elseif(__lang STREQUAL Fortran) - set(__empty_fname empty.f90) - else() - continue() - endif() - - execute_process( - COMMAND ${CMAKE_${__lang}_COMPILER} ${__verbose_flag} ${__empty_fname} - OUTPUT_VARIABLE __cray_output - ERROR_QUIET - ) - string(REGEX MATCH "(^|\n)[^\n]*${__empty_fname}[^\n]*" __cray_driver_cmd "${__cray_output}") - - # Parse include paths - string(REGEX MATCHALL " -I([^ ]+)" __cray_include_flags "${__cray_driver_cmd}") - foreach(_flag IN LISTS __cray_include_flags) - string(REGEX REPLACE "^ -I([^ ]+)" "\\1" _dir "${_flag}") - list(APPEND CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES ${_dir}) +function(__cray_parse_flags_with_sep OUTPUT FLAG_TAG SEP INPUT) + string(REGEX MATCHALL "${SEP}${FLAG_TAG}([^${SEP}]+)" FLAG_ARGS "${INPUT}") + foreach(FLAG_ARG IN LISTS FLAG_ARGS) + string(REGEX REPLACE + "^${SEP}${FLAG_TAG}([^${SEP}]+)" "\\1" FLAG_VALUE + "${FLAG_ARG}") + list(APPEND ${OUTPUT} ${FLAG_VALUE}) endforeach() - if(CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES) - list(REMOVE_DUPLICATES CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES) - endif() - - # Parse library paths - string(REGEX MATCHALL " -L([^ ]+)" __cray_library_dir_flags "${__cray_driver_cmd}") - foreach(_flag IN LISTS __cray_library_dir_flags) - string(REGEX REPLACE "^ -L([^ ]+)" "\\1" _dir "${_flag}") - list(APPEND CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES ${_dir}) - endforeach() - if(CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) - list(REMOVE_DUPLICATES CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) - endif() + set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE) +endfunction() +macro(__cray_parse_flags OUTPUT FLAG_TAG INPUT) + __cray_parse_flags_with_sep(${OUTPUT} ${FLAG_TAG} " " "${INPUT}") +endmacro() - # Parse library paths - string(REGEX MATCHALL " -l([^ ]+)" __cray_library_flags "${__cray_driver_cmd}") - foreach(_flag IN LISTS __cray_library_flags) - string(REGEX REPLACE "^ -l([^ ]+)" "\\1" _dir "${_flag}") - list(APPEND CMAKE_${__lang}_IMPLICIT_LINK_LIBRARIES ${_dir}) - endforeach() - if(CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) - list(REMOVE_DUPLICATES CMAKE_${__lang}_IMPLICIT_LINK_LIBRARIES) +# Remove duplicates in a list +macro(__cray_list_remove_duplicates VAR) + if(${VAR}) + list(REMOVE_DUPLICATES ${VAR}) endif() -endforeach() +endmacro() # Compute the intersection of several lists -macro(__list_intersection L_OUT L0) +function(__cray_list_intersect OUTPUT INPUT0) if(ARGC EQUAL 2) - list(APPEND ${L_OUT} ${${L0}}) + list(APPEND ${OUTPUT} ${${INPUT0}}) else() - foreach(I IN LISTS ${L0}) + foreach(I IN LISTS ${INPUT0}) set(__is_common 1) foreach(L IN LISTS ARGN) list(FIND ${L} "${I}" __idx) @@ -102,26 +82,68 @@ macro(__list_intersection L_OUT L0) endif() endforeach() if(__is_common) - list(APPEND ${L_OUT} "${I}") + list(APPEND ${OUTPUT} "${I}") endif() endforeach() endif() - if(${L_OUT}) - list(REMOVE_DUPLICATES ${L_OUT}) + set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE) +endfunction() + +# Parse the implicit directories used by the wrappers +get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach(__lang IN LISTS __langs) + if(__lang STREQUAL "C") + set(__empty empty.c) + elseif(__lang STREQUAL CXX) + set(__empty empty.cxx) + elseif(__lang STREQUAL Fortran) + set(__empty empty.f90) + else() + continue() endif() -endmacro() + + execute_process( + COMMAND ${CMAKE_${__lang}_COMPILER} ${__verbose_flag} ${__empty} + OUTPUT_VARIABLE __cmd_out + ERROR_QUIET + ) + string(REGEX MATCH "(^|\n)[^\n]*${__empty}[^\n]*" __driver "${__cmd_out}") + + # Parse include paths + set(__cray_flag_args) + __cray_parse_flags(__cray_flag_args "-I" "${__driver}") + __cray_parse_flags(__cray_flag_args "-isystem " "${__driver}") + list(APPEND CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES ${__cray_flag_args}) + __cray_list_remove_duplicates(CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES) + + # Parse library paths + set(__cray_flag_args) + __cray_parse_flags(__cray_flag_args "-L" "${__driver}") + list(APPEND CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES ${__cray_flag_args}) + __cray_list_remove_duplicates(CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) + + # Parse libraries + set(__cray_flag_args) + __cray_parse_flags(__cray_flag_args "-l" "${__driver}") + __cray_parse_flags(__cray_linker_flags "-Wl" "${__driver}") + foreach(F IN LISTS __cray_linker_flags) + __cray_parse_flags_with_sep(__cray_flag_args "-l" "," "${F}") + endforeach() + list(APPEND CMAKE_${__lang}_IMPLICIT_LINK_LIBRARIES ${__cray_flag_args}) + __cray_list_remove_duplicates(CMAKE_${__lang}_IMPLICIT_LINK_LIBRARIES) +endforeach() # Determine the common directories between all languages and add them # as system search paths -set(__cray_include_path_vars) -set(__cray_library_path_vars) +set(__cray_inc_path_vars) +set(__cray_lib_path_vars) foreach(__lang IN LISTS __langs) - list(APPEND __cray_include_path_vars CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES) - list(APPEND __cray_library_path_vars CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) + list(APPEND __cray_inc_path_vars CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES) + list(APPEND __cray_lib_path_vars CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) endforeach() -if(__cray_include_path_vars) - __list_intersection(CMAKE_SYSTEM_INCLUDE_PATH ${__cray_include_path_vars}) +if(__cray_inc_path_vars) + __cray_list_intersect(CMAKE_SYSTEM_INCLUDE_PATH ${__cray_inc_path_vars}) endif() -if(__cray_library_path_vars) - __list_intersection(CMAKE_SYSTEM_LIBRARY_PATH ${__cray_library_path_vars}) +if(__cray_lib_path_vars) + __cray_list_intersect(CMAKE_SYSTEM_LIBRARY_PATH ${__cray_lib_path_vars}) endif() diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake index 77946f2..58398c0 100644 --- a/Modules/Platform/SunOS.cmake +++ b/Modules/Platform/SunOS.cmake @@ -9,12 +9,6 @@ endif() include(Platform/UnixPaths) -# Add the compiler's implicit link directories. -if("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro) - list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES - /opt/SUNWspro/lib /opt/SUNWspro/prod/lib /usr/ccs/lib) -endif() - # The Sun linker needs to find transitive shared library dependencies # in the -L path. set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d706ef4..1ad15fc 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151116) +set(CMake_VERSION_PATCH 20151123) #set(CMake_VERSION_RC 1) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 03417f3..748dd7d 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -734,6 +734,7 @@ bool CMakeSetupDialog::setupFirstConfigure() { dialog.saveToSettings(); this->CMakeThread->cmakeInstance()->setGenerator(dialog.getGenerator()); + this->CMakeThread->cmakeInstance()->setToolset(dialog.getToolset()); QCMakeCacheModel* m = this->CacheValues->cacheModel(); diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx index 6de9f00..61aad72 100644 --- a/Source/QtDialog/FirstConfigure.cxx +++ b/Source/QtDialog/FirstConfigure.cxx @@ -15,6 +15,11 @@ StartCompilerSetup::StartCompilerSetup(QWidget* p) l->addWidget(new QLabel(tr("Specify the generator for this project"))); this->GeneratorOptions = new QComboBox(this); l->addWidget(this->GeneratorOptions); + + // Add the ability to specify toolset (-T parameter) + ToolsetFrame = CreateToolsetWidgets(); + l->addWidget(ToolsetFrame); + l->addSpacing(6); this->CompilerSetupOptions[0] = new QRadioButton(tr("Use default native compilers"), this); @@ -36,17 +41,51 @@ StartCompilerSetup::StartCompilerSetup(QWidget* p) this, SLOT(onSelectionChanged(bool))); QObject::connect(this->CompilerSetupOptions[3], SIGNAL(toggled(bool)), this, SLOT(onSelectionChanged(bool))); + QObject::connect(GeneratorOptions, + SIGNAL(currentIndexChanged(QString const&)), + this, SLOT(onGeneratorChanged(QString const&))); +} + +QFrame* StartCompilerSetup::CreateToolsetWidgets() +{ + QFrame* frame = new QFrame(this); + QVBoxLayout* l = new QVBoxLayout(frame); + l->setContentsMargins(0, 0, 0, 0); + + ToolsetLabel = new QLabel(tr("Optional toolset to use (-T parameter)")); + l->addWidget(ToolsetLabel); + + Toolset = new QLineEdit(frame); + l->addWidget(Toolset); + + return frame; } StartCompilerSetup::~StartCompilerSetup() { } -void StartCompilerSetup::setGenerators(const QStringList& gens) +void StartCompilerSetup::setGenerators( + std::vector<cmake::GeneratorInfo> const& gens) { this->GeneratorOptions->clear(); - this->GeneratorOptions->addItems(gens); -}; + + QStringList generator_list; + + std::vector<cmake::GeneratorInfo>::const_iterator it; + for (it = gens.begin(); it != gens.end(); ++it) + { + generator_list.append(QString::fromLocal8Bit(it->name.c_str())); + + if (it->supportsToolset) + { + this->GeneratorsSupportingToolset.append( + QString::fromLocal8Bit(it->name.c_str())); + } + } + + this->GeneratorOptions->addItems(generator_list); +} void StartCompilerSetup::setCurrentGenerator(const QString& gen) { @@ -62,6 +101,11 @@ QString StartCompilerSetup::getGenerator() const return this->GeneratorOptions->currentText(); }; +QString StartCompilerSetup::getToolset() const +{ + return this->Toolset->text(); +}; + bool StartCompilerSetup::defaultSetup() const { return this->CompilerSetupOptions[0]->isChecked(); @@ -88,6 +132,18 @@ void StartCompilerSetup::onSelectionChanged(bool on) selectionChanged(); } +void StartCompilerSetup::onGeneratorChanged(QString const& name) +{ + if (GeneratorsSupportingToolset.contains(name)) + { + ToolsetFrame->show(); + } + else + { + ToolsetFrame->hide(); + } +} + int StartCompilerSetup::nextId() const { if(compilerSetup()) @@ -325,7 +381,8 @@ FirstConfigure::~FirstConfigure() { } -void FirstConfigure::setGenerators(const QStringList& gens) +void FirstConfigure::setGenerators( + std::vector<cmake::GeneratorInfo> const& gens) { this->mStartCompilerSetupPage->setGenerators(gens); } @@ -335,6 +392,11 @@ QString FirstConfigure::getGenerator() const return this->mStartCompilerSetupPage->getGenerator(); } +QString FirstConfigure::getToolset() const +{ + return this->mStartCompilerSetupPage->getToolset(); +} + void FirstConfigure::loadFromSettings() { QSettings settings; diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h index be390b0..09952b6 100644 --- a/Source/QtDialog/FirstConfigure.h +++ b/Source/QtDialog/FirstConfigure.h @@ -4,6 +4,7 @@ #include <QWizard> #include <QWizardPage> +#include "cmake.h" #include "ui_Compilers.h" #include "ui_CrossCompiler.h" @@ -27,9 +28,10 @@ class StartCompilerSetup : public QWizardPage public: StartCompilerSetup(QWidget* p); ~StartCompilerSetup(); - void setGenerators(const QStringList& gens); + void setGenerators(std::vector<cmake::GeneratorInfo> const& gens); void setCurrentGenerator(const QString& gen); QString getGenerator() const; + QString getToolset() const; bool defaultSetup() const; bool compilerSetup() const; @@ -43,10 +45,18 @@ class StartCompilerSetup : public QWizardPage protected slots: void onSelectionChanged(bool); + void onGeneratorChanged(QString const& name); protected: QComboBox* GeneratorOptions; QRadioButton* CompilerSetupOptions[4]; + QFrame* ToolsetFrame; + QLineEdit* Toolset; + QLabel* ToolsetLabel; + QStringList GeneratorsSupportingToolset; + + private: + QFrame* CreateToolsetWidgets(); }; //! the page that gives basic options for native compilers @@ -140,8 +150,9 @@ public: FirstConfigure(); ~FirstConfigure(); - void setGenerators(const QStringList& gens); + void setGenerators(std::vector<cmake::GeneratorInfo> const& gens); QString getGenerator() const; + QString getToolset() const; bool defaultSetup() const; bool compilerSetup() const; diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 9edbb20..1fcb676 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -15,7 +15,6 @@ #include <QDir> #include <QCoreApplication> -#include "cmake.h" #include "cmState.h" #include "cmSystemTools.h" #include "cmExternalMakefileProjectGenerator.h" @@ -46,21 +45,23 @@ QCMake::QCMake(QObject* p) cmSystemTools::SetInterruptCallback(QCMake::interruptCallback, this); - std::vector<std::string> generators; + std::vector<cmake::GeneratorInfo> generators; this->CMakeInstance->GetRegisteredGenerators(generators); - std::vector<std::string>::iterator iter; - for(iter = generators.begin(); iter != generators.end(); ++iter) + + std::vector<cmake::GeneratorInfo>::const_iterator it; + for(it = generators.begin(); it != generators.end(); ++it) { // Skip the generator "KDevelop3", since there is also // "KDevelop3 - Unix Makefiles", which is the full and official name. // The short name is actually only still there since this was the name // in CMake 2.4, to keep "command line argument compatibility", but // this is not necessary in the GUI. - if (*iter == "KDevelop3") + if (it->name == "KDevelop3") { continue; } - this->AvailableGenerators.append(QString::fromLocal8Bit(iter->c_str())); + + this->AvailableGenerators.push_back(*it); } } @@ -96,6 +97,7 @@ void QCMake::setBinaryDirectory(const QString& _dir) emit this->binaryDirChanged(this->BinaryDirectory); cmState* state = this->CMakeInstance->GetState(); this->setGenerator(QString()); + this->setToolset(QString()); if(!this->CMakeInstance->LoadCache( this->BinaryDirectory.toLocal8Bit().data())) { @@ -124,6 +126,12 @@ void QCMake::setBinaryDirectory(const QString& _dir) CreateFullGeneratorName(gen, extraGen? extraGen : ""); this->setGenerator(QString::fromLocal8Bit(curGen.c_str())); } + + const char* toolset = state->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET"); + if (toolset) + { + this->setToolset(QString::fromLocal8Bit(toolset)); + } } } @@ -137,6 +145,15 @@ void QCMake::setGenerator(const QString& gen) } } +void QCMake::setToolset(const QString& toolset) +{ + if(this->Toolset != toolset) + { + this->Toolset = toolset; + emit this->toolsetChanged(this->Toolset); + } +} + void QCMake::configure() { #ifdef Q_OS_WIN @@ -148,7 +165,7 @@ void QCMake::configure() this->CMakeInstance->SetGlobalGenerator( this->CMakeInstance->CreateGlobalGenerator(this->Generator.toLocal8Bit().data())); this->CMakeInstance->SetGeneratorPlatform(""); - this->CMakeInstance->SetGeneratorToolset(""); + this->CMakeInstance->SetGeneratorToolset(this->Toolset.toLocal8Bit().data()); this->CMakeInstance->LoadCache(); this->CMakeInstance->SetSuppressDevWarnings(this->SuppressDevWarnings); this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode); @@ -396,9 +413,9 @@ QString QCMake::generator() const return this->Generator; } -QStringList QCMake::availableGenerators() const +std::vector<cmake::GeneratorInfo> const& QCMake::availableGenerators() const { - return this->AvailableGenerators; + return AvailableGenerators; } void QCMake::deleteCache() @@ -409,6 +426,7 @@ void QCMake::deleteCache() this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data()); // emit no generator and no properties this->setGenerator(QString()); + this->setToolset(QString()); QCMakePropertyList props = this->properties(); emit this->propertiesChanged(props); } diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index d910eb7..2d45da9 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -17,6 +17,8 @@ #pragma warning ( disable : 4512 ) #endif +#include <vector> + #include <QObject> #include <QString> #include <QVariant> @@ -25,7 +27,7 @@ #include <QMetaType> #include <QAtomicInt> -class cmake; +#include "cmake.h" /// struct to represent cmake properties in Qt /// Value is of type String or Bool @@ -73,6 +75,8 @@ public slots: void setBinaryDirectory(const QString& dir); /// set the desired generator to use void setGenerator(const QString& generator); + /// set the desired generator to use + void setToolset(const QString& toolset); /// do the configure step void configure(); /// generate the files @@ -104,7 +108,7 @@ public: /// get the current generator QString generator() const; /// get the available generators - QStringList availableGenerators() const; + std::vector<cmake::GeneratorInfo> const& availableGenerators() const; /// get whether to do debug output bool getDebugOutput() const; @@ -130,6 +134,8 @@ signals: void errorMessage(const QString& msg); /// signal when debug output changes void debugOutputChanged(bool); + /// signal when the toolset changes + void toolsetChanged(const QString& toolset); protected: cmake* CMakeInstance; @@ -147,7 +153,8 @@ protected: QString SourceDirectory; QString BinaryDirectory; QString Generator; - QStringList AvailableGenerators; + QString Toolset; + std::vector<cmake::GeneratorInfo> AvailableGenerators; QString CMakeExecutable; QAtomicInt InterruptFlag; }; diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index dc4db63..e7263ae 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -70,7 +70,7 @@ * Author: Valery Fine 16/09/96 (E-mail: fine@vxcern.cern.ch) *---------------------------------------------------------------------- */ - +#include "bindexplib.h" #include <cmsys/Encoding.hxx> #include <windows.h> #include <stdio.h> @@ -173,15 +173,17 @@ public: */ DumpSymbols(ObjectHeaderType* ih, - FILE* fout, bool is64) { + std::set<std::string>& symbols, + std::set<std::string>& dataSymbols, + bool is64) + :Symbols(symbols), DataSymbols(dataSymbols) + { this->ObjectImageHeader = ih; this->SymbolTable = (SymbolTableType*) ((DWORD_PTR)this->ObjectImageHeader + this->ObjectImageHeader->PointerToSymbolTable); - this->FileOut = fout; this->SectionHeaders = GetSectionHeaderOffset(this->ObjectImageHeader); - this->ImportFlag = true; this->SymbolCount = this->ObjectImageHeader->NumberOfSymbols; this->Is64Bit = is64; } @@ -296,10 +298,6 @@ public: symbol.erase(0,1); } } - if (this->ImportFlag) { - this->ImportFlag = false; - fprintf(this->FileOut,"EXPORTS \n"); - } /* Check whether it is "Scalar deleting destructor" and "Vector deleting destructor" @@ -319,11 +317,11 @@ public: SectionHeaders[pSymbolTable->SectionNumber-1].Characteristics; if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) { // Read only (i.e. constants) must be excluded - fprintf(this->FileOut, "\t%s \t DATA\n", symbol.c_str()); + this->DataSymbols.insert(symbol); } else { if ( pSymbolTable->Type || !(SectChar & IMAGE_SCN_MEM_READ)) { - fprintf(this->FileOut, "\t%s\n", symbol.c_str()); + this->Symbols.insert(symbol); } else { // printf(" strange symbol: %s \n",symbol.c_str()); } @@ -340,11 +338,7 @@ public: symbol = stringTable + pSymbolTable->N.Name.Long; while (isspace(symbol[0])) symbol.erase(0,1); if (symbol[0] == '_') symbol.erase(0,1); - if (!this->ImportFlag) { - this->ImportFlag = true; - fprintf(this->FileOut,"IMPORTS \n"); - } - fprintf(this->FileOut, "\t%s DATA \n", symbol.c_str()+1); + this->DataSymbols.insert(symbol); } } @@ -357,8 +351,8 @@ public: } } private: - bool ImportFlag; - FILE* FileOut; + std::set<std::string>& Symbols; + std::set<std::string>& DataSymbols; DWORD_PTR SymbolCount; PIMAGE_SECTION_HEADER SectionHeaders; ObjectHeaderType* ObjectImageHeader; @@ -367,7 +361,9 @@ private: }; bool -DumpFile(const char* filename, FILE *fout) +DumpFile(const char* filename, + std::set<std::string>& symbols, + std::set<std::string>& dataSymbols) { HANDLE hFile; HANDLE hFileMapping; @@ -415,7 +411,7 @@ DumpFile(const char* filename, FILE *fout) * and IMAGE_FILE_HEADER.SizeOfOptionalHeader == 0; */ DumpSymbols<IMAGE_FILE_HEADER, IMAGE_SYMBOL> - symbolDumper((PIMAGE_FILE_HEADER) lpFileBase, fout, + symbolDumper((PIMAGE_FILE_HEADER) lpFileBase, symbols, dataSymbols, (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)); symbolDumper.DumpObjFile(); } else { @@ -424,8 +420,9 @@ DumpFile(const char* filename, FILE *fout) (cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase; if(h->Sig1 == 0x0 && h->Sig2 == 0xffff) { DumpSymbols<cmANON_OBJECT_HEADER_BIGOBJ, cmIMAGE_SYMBOL_EX> - symbolDumper((cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase, fout, - (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)); + symbolDumper((cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase, symbols, + dataSymbols, + (h->Machine == IMAGE_FILE_MACHINE_AMD64)); symbolDumper.DumpObjFile(); } else { printf("unrecognized file format in '%s'\n", filename); @@ -437,3 +434,27 @@ DumpFile(const char* filename, FILE *fout) CloseHandle(hFile); return true; } + +bool bindexplib::AddObjectFile(const char* filename) +{ + if(!DumpFile(filename, this->Symbols, this->DataSymbols)) + { + return false; + } + return true; +} + +void bindexplib::WriteFile(FILE* file) +{ + fprintf(file,"EXPORTS \n"); + for(std::set<std::string>::const_iterator i = this->DataSymbols.begin(); + i!= this->DataSymbols.end(); ++i) + { + fprintf(file, "\t%s \t DATA\n", i->c_str()); + } + for(std::set<std::string>::const_iterator i = this->Symbols.begin(); + i!= this->Symbols.end(); ++i) + { + fprintf(file, "\t%s\n", i->c_str()); + } +} diff --git a/Source/bindexplib.h b/Source/bindexplib.h new file mode 100644 index 0000000..8661a4a --- /dev/null +++ b/Source/bindexplib.h @@ -0,0 +1,29 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 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 bindexplib_h +#define bindexplib_h + +#include "cmStandardIncludes.h" + + +class bindexplib +{ +public: + bindexplib() {} + bool AddObjectFile(const char* filename); + void WriteFile(FILE* file); +private: + std::set<std::string> Symbols; + std::set<std::string> DataSymbols; +}; +#endif diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index d062987..37dd328 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -567,8 +567,14 @@ bool cmELFInternalImpl<Types>::LoadDynamicSection() return true; } - // Allocate the dynamic section entries. + // If there are no entries we are done. ELF_Shdr const& sec = this->SectionHeaders[this->DynamicSectionIndex]; + if(sec.sh_entsize == 0) + { + return false; + } + + // Allocate the dynamic section entries. int n = static_cast<int>(sec.sh_size / sec.sh_entsize); this->DynamicSectionEntries.resize(n); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 40afc0e..cc424b4 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3324,6 +3324,7 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name, const char* version = this->GetProperty("VERSION"); const char* soversion = this->GetProperty("SOVERSION"); if(!this->HasSOName(config) || + this->Makefile->IsOn("CMAKE_PLATFORM_NO_VERSIONED_SONAME") || this->IsFrameworkOnApple()) { // Versioning is supported only for shared libraries and modules, diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index ebba599..18d4324 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -38,6 +38,9 @@ public: /** Get the names of the current registered generators */ virtual void GetGenerators(std::vector<std::string>& names) const = 0; + + /** Determine whether or not this generator supports toolsets */ + virtual bool SupportsToolset() const = 0; }; template<class T> @@ -57,6 +60,9 @@ public: /** Get the names of the current registered generators */ virtual void GetGenerators(std::vector<std::string>& names) const { names.push_back(T::GetActualName()); } + + /** Determine whether or not this generator supports toolsets */ + virtual bool SupportsToolset() const { return T::SupportsToolset(); } }; #endif diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 480cd6a..6f86c5d 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -35,6 +35,7 @@ public: /// @return the name of this generator. static std::string GetActualName() { return "Green Hills MULTI"; } + ///! Get the name for this generator virtual std::string GetName() const { return this->GetActualName(); } @@ -42,6 +43,12 @@ public: static void GetDocumentation(cmDocumentationEntry &entry); /** + * Utilized by the generator factory to determine if this generator + * supports toolsets. + */ + static bool SupportsToolset() { return false; } + + /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. */ diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index a8a307c..0f06e43 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -275,7 +275,7 @@ void cmGlobalNinjaGenerator::AddCustomCommandRule() /*deptype*/ "", /*rspfile*/ "", /*rspcontent*/ "", - /*restat*/ "1", + /*restat*/ "", // bound on each build statement as needed /*generator*/ false); } @@ -284,6 +284,7 @@ cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command, const std::string& description, const std::string& comment, bool uses_terminal, + bool restat, const cmNinjaDeps& outputs, const cmNinjaDeps& deps, const cmNinjaDeps& orderOnly) @@ -300,6 +301,10 @@ cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command, cmNinjaVars vars; vars["COMMAND"] = cmd; vars["DESC"] = EncodeLiteral(description); + if (restat) + { + vars["restat"] = "1"; + } if (uses_terminal && SupportsConsolePool()) { vars["pool"] = "console"; @@ -923,6 +928,7 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies() WriteCustomCommandBuild(/*command=*/"", /*description=*/"", "Assume dependencies for generated source file.", /*uses_terminal*/false, + /*restat*/true, cmNinjaDeps(1, i->first), deps); } } diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 46bd588..8656590 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -74,6 +74,12 @@ public: static void WriteComment(std::ostream& os, const std::string& comment); /** + * Utilized by the generator factory to determine if this generator + * supports toolsets. + */ + static bool SupportsToolset() { return false; } + + /** * Write a build statement to @a os with the @a comment using * the @a rule the list of @a outputs files and inputs. * It also writes the variables bound to this build statement. @@ -106,6 +112,7 @@ public: const std::string& description, const std::string& comment, bool uses_terminal, + bool restat, const cmNinjaDeps& outputs, const cmNinjaDeps& deps = cmNinjaDeps(), const cmNinjaDeps& orderOnly = cmNinjaDeps()); diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 54fdc0e..0591a5a 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -64,6 +64,12 @@ public: return cmGlobalUnixMakefileGenerator3::GetActualName();} static std::string GetActualName() {return "Unix Makefiles";} + /** + * Utilized by the generator factory to determine if this generator + * supports toolsets. + */ + static bool SupportsToolset() { return false; } + /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index e568704..c49008d 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -81,6 +81,8 @@ public: names.push_back(vs10generatorName + std::string(" IA64")); names.push_back(vs10generatorName + std::string(" Win64")); } + + virtual bool SupportsToolset() const { return true; } }; //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index b9b4fff..9522f6e 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -96,6 +96,8 @@ public: names.push_back(std::string(vs11generatorName) + " " + *i); } } + + virtual bool SupportsToolset() const { return true; } }; //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index efa1133..568d4d7 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -76,6 +76,8 @@ public: names.push_back(vs12generatorName + std::string(" ARM")); names.push_back(vs12generatorName + std::string(" Win64")); } + + virtual bool SupportsToolset() const { return true; } }; //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 41825fb..a05ac24 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -76,6 +76,8 @@ public: names.push_back(vs14generatorName + std::string(" ARM")); names.push_back(vs14generatorName + std::string(" Win64")); } + + virtual bool SupportsToolset() const { return true; } }; //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 993a48f..ae2988e 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -36,6 +36,12 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); + /** + * Utilized by the generator factory to determine if this generator + * supports toolsets. + */ + static bool SupportsToolset() { return false; } + ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf); diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index fe6db2e..de2d35e 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -53,6 +53,12 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); /** + * Utilized by the generator factory to determine if this generator + * supports toolsets. + */ + static bool SupportsToolset() { return false; } + + /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. */ diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 5e239b8..3abff6c 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -84,6 +84,8 @@ public: names.push_back("Visual Studio 8 2005 " + *i); } } + + virtual bool SupportsToolset() const { return false; } }; //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index d98793a..884f754 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -88,6 +88,8 @@ public: names.push_back("Visual Studio 9 2008 " + *i); } } + + virtual bool SupportsToolset() const { return false; } }; //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 2df07cb..475efa8 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -125,6 +125,8 @@ public: virtual void GetGenerators(std::vector<std::string>& names) const { names.push_back(cmGlobalXCodeGenerator::GetActualName()); } + + virtual bool SupportsToolset() const { return true; } }; //---------------------------------------------------------------------------- diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index ecaa269..b2927a9 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -398,6 +398,16 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( const std::vector<std::string> &byproducts = ccg.GetByproducts(); cmNinjaDeps ninjaOutputs(outputs.size()+byproducts.size()), ninjaDeps; + bool symbolic = false; + for (std::vector<std::string>::const_iterator o = outputs.begin(); + o != outputs.end(); ++o) + { + if (cmSourceFile* sf = this->Makefile->GetSource(*o)) + { + symbolic = sf->GetPropertyAsBool("SYMBOLIC"); + } + } + #if 0 #error TODO: Once CC in an ExternalProject target must provide the \ file of each imported target that has an add_dependencies pointing \ @@ -434,6 +444,7 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( this->ConstructComment(ccg), "Custom command for " + ninjaOutputs[0], cc->GetUsesTerminal(), + /*restat*/!symbolic, ninjaOutputs, ninjaDeps, orderOnlyDeps); diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index edc65f0..ac66fcd 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -131,6 +131,7 @@ void cmNinjaUtilityTargetGenerator::Generate() desc, "Utility command for " + this->GetTargetName(), uses_terminal, + /*restat*/true, util_outputs, deps); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d5bc3d2..ee1e878 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -957,18 +957,32 @@ void cmake::AddDefaultExtraGenerators() //---------------------------------------------------------------------------- -void cmake::GetRegisteredGenerators(std::vector<std::string>& names) +void cmake::GetRegisteredGenerators(std::vector<GeneratorInfo>& generators) { - for(RegisteredGeneratorsVector::const_iterator i = this->Generators.begin(); - i != this->Generators.end(); ++i) + for (RegisteredGeneratorsVector::const_iterator + i = this->Generators.begin(), e = this->Generators.end(); + i != e; ++i) { + std::vector<std::string> names; (*i)->GetGenerators(names); + + for (size_t j = 0; j < names.size(); ++j) + { + GeneratorInfo info; + info.supportsToolset = (*i)->SupportsToolset(); + info.name = names[j]; + generators.push_back(info); + } } - for(RegisteredExtraGeneratorsMap::const_iterator - i = this->ExtraGenerators.begin(); - i != this->ExtraGenerators.end(); ++i) + + for (RegisteredExtraGeneratorsMap::const_iterator + i = this->ExtraGenerators.begin(), e = this->ExtraGenerators.end(); + i != e; ++i) { - names.push_back(i->first); + GeneratorInfo info; + info.name = i->first; + info.supportsToolset = false; + generators.push_back(info); } } diff --git a/Source/cmake.h b/Source/cmake.h index 6b0e83f..c584ad9 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -89,6 +89,13 @@ class cmake */ FIND_PACKAGE_MODE }; + + struct GeneratorInfo + { + std::string name; + bool supportsToolset; + }; + typedef std::map<std::string, cmInstalledFile> InstalledFilesMap; /// Default constructor @@ -161,7 +168,7 @@ class cmake void SetGlobalGenerator(cmGlobalGenerator *); ///! Get the names of the current registered generators - void GetRegisteredGenerators(std::vector<std::string>& names); + void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators); ///! Set the name of the selected generator-specific platform. void SetGeneratorPlatform(std::string const& ts) diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index be492ed..21b126b 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -35,8 +35,7 @@ #include <stdlib.h> // required for atoi #if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE) -// defined in binexplib.cxx -bool DumpFile(const char* filename, FILE *fout); +#include "bindexplib.h" #endif void CMakeCommandUsage(const char* program) @@ -240,13 +239,16 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) return 1; } std::string objfile; + bindexplib deffile; while(cmSystemTools::GetLineFromStream(fin, objfile)) { - if (!DumpFile(objfile.c_str(), fout)) + if( !deffile.AddObjectFile(objfile.c_str())) { return 1; } } + deffile.WriteFile(fout); + fclose(fout); return 0; } #endif @@ -1553,7 +1555,6 @@ bool cmVSLink::Parse(std::vector<std::string>::const_iterator argBeg, // pass it to the link command. this->ManifestFileRC = intDir + "/manifest.rc"; this->ManifestFileRes = intDir + "/manifest.res"; - this->LinkCommand.push_back(this->ManifestFileRes); } else if (this->UserManifests.empty()) { @@ -1661,6 +1662,9 @@ int cmVSLink::LinkIncremental() return -1; } + // Tell the linker to use our manifest compiled into a resource. + this->LinkCommand.push_back(this->ManifestFileRes); + // Run the link command (possibly generates intermediate manifest). if (!RunCommand("LINK Pass 1", this->LinkCommand, this->Verbose)) { diff --git a/Tests/MSManifest/Subdir/CMakeLists.txt b/Tests/MSManifest/Subdir/CMakeLists.txt index a47cf00..11272bb 100644 --- a/Tests/MSManifest/Subdir/CMakeLists.txt +++ b/Tests/MSManifest/Subdir/CMakeLists.txt @@ -6,4 +6,6 @@ if(MSVC AND NOT MSVC_VERSION LESS 1400) COMMAND ${CMAKE_COMMAND} -Dexe=$<TARGET_FILE:MSManifest> -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake ) + add_executable(MSManifestNone main.c) + set_property(TARGET MSManifestNone PROPERTY LINK_FLAGS "/MANIFEST:NO") endif() diff --git a/Tests/RunCMake/AutoExportDll/sub/sub.cxx b/Tests/RunCMake/AutoExportDll/sub/sub.cxx index 9766b41..9a3145e 100644 --- a/Tests/RunCMake/AutoExportDll/sub/sub.cxx +++ b/Tests/RunCMake/AutoExportDll/sub/sub.cxx @@ -1,4 +1,6 @@ +#include <stdio.h> int sub() { + printf(""); return 10; } diff --git a/Tests/RunCMake/BuildDepends/Custom-Always.cmake b/Tests/RunCMake/BuildDepends/Custom-Always.cmake new file mode 100644 index 0000000..d412708 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/Custom-Always.cmake @@ -0,0 +1,24 @@ +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/before-always + COMMAND ${CMAKE_COMMAND} -E touch before-always + ) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/always + COMMAND ${CMAKE_COMMAND} -E touch always-updated + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/before-always + ) +set_property(SOURCE always PROPERTY SYMBOLIC 1) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/after-always + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/always + COMMAND ${CMAKE_COMMAND} -E touch after-always + ) + +add_custom_target(drive ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/after-always) + +file(GENERATE OUTPUT check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " +set(check_pairs + \"${CMAKE_CURRENT_BINARY_DIR}/always-updated|${CMAKE_CURRENT_BINARY_DIR}/before-always\" + \"${CMAKE_CURRENT_BINARY_DIR}/after-always|${CMAKE_CURRENT_BINARY_DIR}/always-updated\" + ) +") diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index a578408..31c72fb 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -38,3 +38,5 @@ if(NOT RunCMake_GENERATOR MATCHES "Visual Studio [67]|Xcode") run_BuildDepends(C-Exe-Manifest) unset(run_BuildDepends_skip_step_2) endif() + +run_BuildDepends(Custom-Always) |