diff options
29 files changed, 394 insertions, 278 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e8b928..c8337f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,15 +180,33 @@ MACRO(CMAKE_SETUP_TESTING) ENDMACRO(CMAKE_SETUP_TESTING) +# Provide a way for Visual Studio Express users to turn OFF the new FOLDER +# organization feature. Default to ON for non-Express users. Express users must +# explicitly turn off this option to build CMake in the Express IDE... +# +OPTION(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON) +MARK_AS_ADVANCED(CMAKE_USE_FOLDERS) + + +#----------------------------------------------------------------------- +# a macro that only sets the FOLDER target property if it's +# "appropriate" +#----------------------------------------------------------------------- MACRO(CMAKE_SET_TARGET_FOLDER tgt folder) - # Really, I just want this to be an "if(TARGET ${tgt})" ... - # but I'm not sure that our min req'd., CMake 2.4.5 can handle - # that... so I'm just activating this for now, with a version - # compare, and only for MSVC builds. - IF(MSVC) - IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8) - SET_PROPERTY(TARGET "${tgt}" PROPERTY FOLDER "${folder}") + IF(CMAKE_USE_FOLDERS) + SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) + + # Really, I just want this to be an "if(TARGET ${tgt})" ... + # but I'm not sure that our min req'd., CMake 2.4.5 can handle + # that... so I'm just activating this for now, with a version + # compare, and only for MSVC builds. + IF(MSVC) + IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8) + SET_PROPERTY(TARGET "${tgt}" PROPERTY FOLDER "${folder}") + ENDIF() ENDIF() + ELSE() + SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS OFF) ENDIF() ENDMACRO(CMAKE_SET_TARGET_FOLDER) diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index 578aff9..86a824a 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -26,6 +26,8 @@ ELSE(UNIX) SET(CMAKE_C_OUTPUT_EXTENSION .obj) ENDIF(UNIX) +SET(_INCLUDED_FILE 0) + # Load compiler-specific information. IF(CMAKE_C_COMPILER_ID) INCLUDE(Compiler/${CMAKE_C_COMPILER_ID}-C OPTIONAL) diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 869894c..680f8fd 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -26,6 +26,8 @@ ELSE(UNIX) SET(CMAKE_CXX_OUTPUT_EXTENSION .obj) ENDIF(UNIX) +SET(_INCLUDED_FILE 0) + # Load compiler-specific information. IF(CMAKE_CXX_COMPILER_ID) INCLUDE(Compiler/${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL) diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake index 8e4eb34..a877e6e 100644 --- a/Modules/CMakeDetermineVSServicePack.cmake +++ b/Modules/CMakeDetermineVSServicePack.cmake @@ -23,8 +23,8 @@ # =========================== #============================================================================= -# Copyright 2009 Kitware, Inc. -# Copyright 2009 Philip Lowman <philip@yhbt.com> +# Copyright 2009-2010 Kitware, Inc. +# Copyright 2009-2010 Philip Lowman <philip@yhbt.com> # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -47,6 +47,8 @@ function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version) set(_version "vc90") elseif(${_cl_version} VERSION_EQUAL "15.00.30729.01") set(_version "vc90sp1") + elseif(${_cl_version} VERSION_EQUAL "16.00.30319.01") + set(_version "vc100") else() set(_version "") endif() diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index cdb8038..f6a52c6 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -16,6 +16,8 @@ # It also loads the available platform file for the system-compiler # if it exists. +SET(_INCLUDED_FILE 0) + # Load compiler-specific information. IF(CMAKE_Fortran_COMPILER_ID) INCLUDE(Compiler/${CMAKE_Fortran_COMPILER_ID}-Fortran OPTIONAL) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 3ade3aa..e2d78802 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -548,16 +548,16 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ # We do only save CPack installed tree in _prepr # and then restore it in build. %prep -mv $RPM_BUILD_ROOT \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot +mv $RPM_BUILD_ROOT \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" #p build %install if [ -e $RPM_BUILD_ROOT ]; then - mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot/* $RPM_BUILD_ROOT + mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot/*\" $RPM_BUILD_ROOT else - mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot $RPM_BUILD_ROOT + mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT fi %clean diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 2377e10..3ae4e14 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -20,7 +20,6 @@ # set(Boost_USE_STATIC_LIBS ON) # set(Boost_USE_MULTITHREADED ON) # set(Boost_USE_STATIC_RUNTIME OFF) -# set(Boost_COMPAT_STATIC_RUNTIME OFF) # find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... ) # # if(Boost_FOUND) @@ -94,7 +93,10 @@ # # Boost_USE_STATIC_RUNTIME If enabled, searches for boost libraries # linked against a static C++ standard library -# ('s' ABI tag). Defaults to OFF. +# ('s' ABI tag). This option should be set to +# ON or OFF because the default behavior +# if not specified is platform dependent +# for backwards compatibility. # [Since CMake 2.8.3] # # Boost_USE_DEBUG_PYTHON If enabled, searches for boost libraries @@ -114,14 +116,6 @@ # Defaults to OFF. # [Since CMake 2.8.3] # -# Boost_COMPAT_STATIC_RUNTIME Set to OFF to disable backwards compatible -# searching for libraries with the 's' ABI -# tag on WIN32 after normal searches. You -# should set this to OFF and also set -# Boost_USE_STATIC_RUNTIME appropriately. -# If not specified, defaults to ON. -# [Since CMake 2.8.3] -# # Other Variables used by this module which you may want to set. # # Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching @@ -372,9 +366,6 @@ endfunction() IF(NOT DEFINED Boost_USE_MULTITHREADED) SET(Boost_USE_MULTITHREADED TRUE) ENDIF() -if(NOT DEFINED Boost_COMPAT_STATIC_RUNTIME) - set(Boost_COMPAT_STATIC_RUNTIME TRUE) -endif() if(Boost_FIND_VERSION_EXACT) # The version may appear in a directory with or without the patch @@ -868,11 +859,11 @@ ELSE (_boost_IN_CACHE) # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found) # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found) # We maintain this behavior since changing it could break people's builds. - # To disable the ambiguous behavior, the user can - # set Boost_COMPAT_STATIC_RUNTIME to FALSE + # To disable the ambiguous behavior, the user need only + # set Boost_USE_STATIC_RUNTIME either ON or OFF. set(_boost_STATIC_RUNTIME_WORKAROUND false) - if(Boost_COMPAT_STATIC_RUNTIME AND WIN32 AND Boost_USE_STATIC_LIBS) - if(NOT Boost_USE_STATIC_RUNTIME) + if(WIN32 AND Boost_USE_STATIC_LIBS) + if(NOT DEFINED Boost_USE_STATIC_RUNTIME) set(_boost_STATIC_RUNTIME_WORKAROUND true) endif() endif() diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 49bff5b..91215d5 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -612,8 +612,10 @@ else() endif() ######################## -# Look for the SDK stuff +# Look for the SDK stuff. As of CUDA 3.0 NVSDKCUDA_ROOT has been replaced with +# NVSDKCOMPUTE_ROOT with the old CUDA C contents moved into the C subdirectory find_path(CUDA_SDK_ROOT_DIR common/inc/cutil.h + "$ENV{NVSDKCOMPUTE_ROOT}/C" "$ENV{NVSDKCUDA_ROOT}" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Installed Products\\NVIDIA SDK 10\\Compute;InstallDir]" "/Developer/GPU\ Computing/C" @@ -941,8 +943,8 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) # we convert the strings to lists (like we want). if(CUDA_PROPAGATE_HOST_FLAGS) - # nvcc chokes on -g3, so replace it with -g - if(CMAKE_COMPILER_IS_GNUCC) + # nvcc chokes on -g3 in versions previous to 3.0, so replace it with -g + if(CMAKE_COMPILER_IS_GNUCC AND CUDA_VERSION VERSION_LESS "3.0") string(REPLACE "-g3" "-g" _cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") else() set(_cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 1746fb5..90c9de4 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -293,7 +293,7 @@ else() # If the HDF5 include directory was found, open H5pubconf.h to determine if # HDF5 was compiled with parallel IO support set( HDF5_IS_PARALLEL FALSE ) - foreach( _dir HDF5_INCLUDE_DIRS ) + foreach( _dir IN LISTS HDF5_INCLUDE_DIRS ) if( EXISTS "${_dir}/H5pubconf.h" ) file( STRINGS "${_dir}/H5pubconf.h" HDF5_HAVE_PARALLEL_DEFINE diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 3419134..78699cc 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -81,6 +81,7 @@ set(_MPI_PACKAGE_DIR lib/openmpi "MPICH/SDK" "Microsoft Compute Cluster Pack" + "Microsoft HPC Pack 2008 R2" ) set(_MPI_PREFIX_PATH) @@ -306,7 +307,7 @@ else (MPI_COMPILE_CMDLINE) # No MPI compiler to interogate so attempt to find everything with find functions. find_path(MPI_INCLUDE_PATH mpi.h HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} - PATH_SUFFIXES include + PATH_SUFFIXES include Inc ) # Decide between 32-bit and 64-bit libraries for Microsoft's MPI diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index d2d39e6..45bbd2e 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -242,6 +242,7 @@ # QT_LIBRARY_DIR Path to "lib" of Qt4 # QT_PLUGINS_DIR Path to "plugins" for Qt4 # QT_TRANSLATIONS_DIR Path to "translations" of Qt4 +# QT_IMPORTS_DIR Path to "imports" of Qt4 # QT_DOC_DIR Path to "doc" of Qt4 # QT_MKSPECS_DIR Path to "mkspecs" of Qt4 # @@ -445,6 +446,14 @@ MACRO (_QT4_ADJUST_LIB_VARS _camelCaseBasename) MARK_AS_ADVANCED(QT_${basename}_LIBRARY QT_${basename}_LIBRARY_RELEASE QT_${basename}_LIBRARY_DEBUG QT_${basename}_INCLUDE_DIR) ENDMACRO (_QT4_ADJUST_LIB_VARS) +function(_QT4_QUERY_QMAKE VAR RESULT) + exec_program(${QT_QMAKE_EXECUTABLE} ARGS "-query ${VAR}" RETURN_VALUE return_code OUTPUT_VARIABLE output ) + if(NOT return_code) + file(TO_CMAKE_PATH "${output}" output) + set(${RESULT} ${output} PARENT_SCOPE) + endif(NOT return_code) +endfunction(_QT4_QUERY_QMAKE) + SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE) @@ -470,7 +479,7 @@ IF (QT_QMAKE_EXECUTABLE) SET(QT4_QMAKE_FOUND FALSE) - EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) + _qt4_query_qmake(QT_VERSION QTVERSION) # check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path IF("${QTVERSION}" MATCHES "Unknown") @@ -482,8 +491,7 @@ IF (QT_QMAKE_EXECUTABLE) DOC "The qmake executable for the Qt installation to use" ) IF(QT_QMAKE_EXECUTABLE) - EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) + _qt4_query_qmake(QT_VERSION QTVERSION) ENDIF(QT_QMAKE_EXECUTABLE) ENDIF("${QTVERSION}" MATCHES "Unknown") @@ -559,9 +567,7 @@ IF (QT4_QMAKE_FOUND) # ask qmake for the mkspecs directory # we do this first because QT_LIBINFIX might be set IF (NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QMAKE_MKSPECS" - OUTPUT_VARIABLE qt_mkspecs_dirs ) + _qt4_query_qmake(QMAKE_MKSPECS qt_mkspecs_dirs) # do not replace : on windows as it might be a drive letter # and windows should already use ; as a separator IF(NOT WIN32) @@ -592,11 +598,7 @@ IF (QT4_QMAKE_FOUND) # ask qmake for the library dir as a hint, then search for QtCore library and use that as a reference for finding the # others and for setting QT_LIBRARY_DIR IF (NOT QT_QTCORE_LIBRARY OR QT_QMAKE_CHANGED) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_INSTALL_LIBS" - OUTPUT_VARIABLE QT_LIBRARY_DIR_TMP ) - # make sure we have / and not \ as qmake gives on windows - FILE(TO_CMAKE_PATH "${QT_LIBRARY_DIR_TMP}" QT_LIBRARY_DIR_TMP) + _qt4_query_qmake(QT_INSTALL_LIBS QT_LIBRARY_DIR_TMP) SET(QT_QTCORE_LIBRARY_RELEASE NOTFOUND) SET(QT_QTCORE_LIBRARY_DEBUG NOTFOUND) FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE @@ -649,21 +651,13 @@ IF (QT4_QMAKE_FOUND) # ask qmake for the binary dir IF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) - EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_INSTALL_BINS" - OUTPUT_VARIABLE qt_bins ) - # make sure we have / and not \ as qmake gives on windows - FILE(TO_CMAKE_PATH "${qt_bins}" qt_bins) - SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE) + _qt4_query_qmake(QT_INSTALL_BINS qt_bins) + SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE) ENDIF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) # ask qmake for the include dir IF (QT_LIBRARY_DIR AND (NOT QT_QTCORE_INCLUDE_DIR OR NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED)) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_INSTALL_HEADERS" - OUTPUT_VARIABLE qt_headers ) - # make sure we have / and not \ as qmake gives on windows - FILE(TO_CMAKE_PATH "${qt_headers}" qt_headers) + _qt4_query_qmake(QT_INSTALL_HEADERS qt_headers) SET(QT_QTCORE_INCLUDE_DIR NOTFOUND) FIND_PATH(QT_QTCORE_INCLUDE_DIR QtCore HINTS ${qt_headers} @@ -703,22 +697,14 @@ IF (QT4_QMAKE_FOUND) # ask qmake for the documentation directory IF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_INSTALL_DOCS" - OUTPUT_VARIABLE qt_doc_dir ) - # make sure we have / and not \ as qmake gives on windows - FILE(TO_CMAKE_PATH "${qt_doc_dir}" qt_doc_dir) + _qt4_query_qmake(QT_INSTALL_DOCS qt_doc_dir) SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs" FORCE) ENDIF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED) # ask qmake for the plugins directory IF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_INSTALL_PLUGINS" - OUTPUT_VARIABLE qt_plugins_dir ) - # make sure we have / and not \ as qmake gives on windows - FILE(TO_CMAKE_PATH "${qt_plugins_dir}" qt_plugins_dir) + _qt4_query_qmake(QT_INSTALL_PLUGINS qt_plugins_dir) SET(QT_PLUGINS_DIR NOTFOUND) foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/plugins") @@ -730,14 +716,27 @@ IF (QT4_QMAKE_FOUND) # ask qmake for the translations directory IF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_INSTALL_TRANSLATIONS" - OUTPUT_VARIABLE qt_translations_dir ) - # make sure we have / and not \ as qmake gives on windows - FILE(TO_CMAKE_PATH "${qt_translations_dir}" qt_translations_dir) + _qt4_query_qmake(QT_INSTALL_TRANSLATIONS qt_translations_dir) SET(QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH "The location of the Qt translations" FORCE) ENDIF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED) + # ask qmake for the imports directory + IF (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED) + _qt4_query_qmake(QT_INSTALL_IMPORTS qt_imports_dir) + if(qt_imports_dir) + SET(QT_IMPORTS_DIR NOTFOUND) + foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) + set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/imports") + endforeach(qt_cross_path) + FIND_PATH(QT_IMPORTS_DIR NAMES Qt + HINTS ${qt_cross_paths} ${qt_imports_dir} + DOC "The location of the Qt imports" + NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH) + mark_as_advanced(QT_IMPORTS_DIR) + endif(qt_imports_dir) + ENDIF (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED) + # Make variables changeble to the advanced user MARK_AS_ADVANCED( QT_LIBRARY_DIR QT_DOC_DIR QT_MKSPECS_DIR QT_PLUGINS_DIR QT_TRANSLATIONS_DIR) diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake index a58c48d..11f66b0 100644 --- a/Modules/FindSubversion.cmake +++ b/Modules/FindSubversion.cmake @@ -52,11 +52,18 @@ FIND_PROGRAM(Subversion_SVN_EXECUTABLE svn MARK_AS_ADVANCED(Subversion_SVN_EXECUTABLE) IF(Subversion_SVN_EXECUTABLE) + # the subversion commands should be executed with the C locale, otherwise + # the message (which are parsed) may be translated, Alex + SET(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}") + SET(ENV{LC_ALL} C) EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} --version OUTPUT_VARIABLE Subversion_VERSION_SVN OUTPUT_STRIP_TRAILING_WHITESPACE) + # restore the previous LC_ALL + SET(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL}) + STRING(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*" "\\2" Subversion_VERSION_SVN "${Subversion_VERSION_SVN}") diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 4cb2b48..e6d7a6d 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -289,14 +289,10 @@ void cmExtraCodeBlocksGenerator std::string fileName = *(splitted.end()-1); splitted.erase(splitted.end() - 1, splitted.end()); - // We don't want paths with ".." in them - // reasons are that we don't want files outside the project - // TODO: the path should be normalized first though // We don't want paths with CMakeFiles in them // or do we? // In speedcrunch those where purely internal if (splitted.size() >= 1 - && relative.find("..") == std::string::npos && relative.find("CMakeFiles") == std::string::npos) { tree.InsertPath(splitted, 1, fileName); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index c6d05b0..0def336 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1871,9 +1871,10 @@ bool cmGlobalGenerator::UseFolderProperty() return cmSystemTools::IsOn(prop); } - // By default, this feature is ON: + // By default, this feature is OFF, since it is not supported in the + // Visual Studio Express editions: // - return true; + return false; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 751dc24..2b9e5ba 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -323,7 +323,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( if (cumulativePath.empty()) { - cumulativePath = *iter; + cumulativePath = "CMAKE_FOLDER_GUID_" + *iter; } else { @@ -431,14 +431,22 @@ void cmGlobalVisualStudio7Generator //---------------------------------------------------------------------------- void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout) { + const char *prefix = "CMAKE_FOLDER_GUID_"; + const std::string::size_type skip_prefix = strlen(prefix); std::string guidProjectTypeFolder = "2150E333-8FDC-42A3-9474-1A3956D46DE8"; for(std::map<std::string,std::set<std::string> >::iterator iter = VisualStudioFolders.begin(); iter != VisualStudioFolders.end(); ++iter) { std::string fullName = iter->first; std::string guid = this->GetGUID(fullName.c_str()); - std::string nameOnly = cmSystemTools::GetFilenameName(fullName); + cmSystemTools::ReplaceString(fullName, "/", "\\"); + if (cmSystemTools::StringStartsWith(fullName.c_str(), prefix)) + { + fullName = fullName.substr(skip_prefix); + } + + std::string nameOnly = cmSystemTools::GetFilenameName(fullName); fout << "Project(\"{" << guidProjectTypeFolder << "}\") = \"" << diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index daa6b3a..c8ea339 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -69,14 +69,6 @@ public: i.e. "Can I build Debug and Release in the same tree?" */ virtual bool IsMultiConfig() { return true; } -protected: - // Does this VS version link targets to each other if there are - // dependencies in the SLN file? This was done for VS versions - // below 8. - virtual bool VSLinksDependencies() const { return true; } - - virtual const char* GetIDEVersion() = 0; - struct TargetCompare { bool operator()(cmTarget const* l, cmTarget const* r) const; @@ -87,6 +79,14 @@ protected: OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const&); }; +protected: + // Does this VS version link targets to each other if there are + // dependencies in the SLN file? This was done for VS versions + // below 8. + virtual bool VSLinksDependencies() const { return true; } + + virtual const char* GetIDEVersion() = 0; + virtual bool ComputeTargetDepends(); class VSDependSet: public std::set<cmStdString> {}; class VSDependMap: public std::map<cmTarget*, VSDependSet> {}; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 4e9969d..0976a4d 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -131,8 +131,8 @@ cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version) //---------------------------------------------------------------------------- cmGlobalGenerator* cmGlobalXCodeGenerator::New() -{ -#if defined(CMAKE_BUILD_WITH_CMAKE) +{ +#if defined(CMAKE_BUILD_WITH_CMAKE) cmXcodeVersionParser parser; parser.ParseFile ("/Developer/Applications/Xcode.app/Contents/version.plist"); @@ -156,7 +156,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::New() void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const& lang, cmMakefile * mf, bool optional) -{ +{ mf->AddDefinition("XCODE","1"); mf->AddDefinition("XCODE_VERSION", this->VersionString.c_str()); if(this->XcodeVersion == 15) @@ -175,12 +175,12 @@ 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 + // initialize Architectures so it can be used by // GetTargetObjectFileDirectories this->cmGlobalGenerator::EnableLanguage(lang, mf, optional); - const char* osxArch = + const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES"); - const char* sysroot = + const char* sysroot = mf->GetDefinition("CMAKE_OSX_SYSROOT"); if(osxArch && sysroot) { @@ -193,10 +193,10 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const& //---------------------------------------------------------------------------- std::string cmGlobalXCodeGenerator ::GenerateBuildCommand(const char* makeProgram, - const char *projectName, - const char* additionalOptions, + const char *projectName, + const char* additionalOptions, const char *targetName, - const char* config, + const char* config, bool ignoreErrors, bool) { @@ -210,7 +210,7 @@ std::string cmGlobalXCodeGenerator "Generator cannot find the appropriate make command."); return ""; } - std::string makeCommand = + std::string makeCommand = cmSystemTools::ConvertToOutputPath(makeProgram); std::string lowerCaseCommand = makeCommand; cmSystemTools::LowerCase(lowerCaseCommand); @@ -284,7 +284,7 @@ void cmGlobalXCodeGenerator::Generate() // make sure extra targets are added before calling // the parent generate which will call trace depends for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) - { + { cmLocalGenerator* root = it->second[0]; this->SetGenerationRoot(root); // add ALL_BUILD, INSTALL, etc @@ -293,7 +293,7 @@ void cmGlobalXCodeGenerator::Generate() this->ForceLinkerLanguages(); this->cmGlobalGenerator::Generate(); for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) - { + { cmLocalGenerator* root = it->second[0]; this->SetGenerationRoot(root); // now create the project @@ -319,8 +319,8 @@ void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root) } //---------------------------------------------------------------------------- -void -cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, +void +cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& gens) { cmMakefile* mf = root->GetMakefile(); @@ -339,7 +339,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, listfile += "CMakeLists.txt"; allbuild->AddSource(listfile.c_str()); - // Add XCODE depend helper + // Add XCODE depend helper std::string dir = mf->GetCurrentOutputDirectory(); cmCustomCommandLine makecommand; makecommand.push_back("make"); @@ -361,7 +361,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, for(std::vector<cmLocalGenerator*>::iterator i = gens.begin(); i != gens.end(); ++i) { - cmLocalGenerator* lg = *i; + cmLocalGenerator* lg = *i; if(this->IsExcluded(root, *i)) { continue; @@ -370,7 +370,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { cmTarget& target = l->second; - // make all exe, shared libs and modules + // make all exe, shared libs and modules // run the depend check makefile as a post build rule // this will make sure that when the next target is built // things are up-to-date @@ -385,7 +385,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, cmTarget::POST_BUILD, "Depend check for xcode", dir.c_str()); - + } if(!target.GetPropertyAsBool("EXCLUDE_FROM_ALL")) { @@ -407,8 +407,8 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(cmLocalGenerator* root) cmMakefile* mf = root->GetMakefile(); std::vector<std::string> lfiles = mf->GetListFiles(); // sort the array - std::sort(lfiles.begin(), lfiles.end(), std::less<std::string>()); - std::vector<std::string>::iterator new_end = + std::sort(lfiles.begin(), lfiles.end(), std::less<std::string>()); + std::vector<std::string>::iterator new_end = std::unique(lfiles.begin(), lfiles.end()); lfiles.erase(new_end, lfiles.end()); std::string dir = mf->GetHomeOutputDirectory(); @@ -428,7 +428,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(cmLocalGenerator* root) makefileStream << "\\\n" << this->ConvertToRelativeForMake(i->c_str()); } std::string cmake = mf->GetRequiredDefinition("CMAKE_COMMAND"); - makefileStream << "\n\t" << this->ConvertToRelativeForMake(cmake.c_str()) + makefileStream << "\n\t" << this->ConvertToRelativeForMake(cmake.c_str()) << " -H" << this->ConvertToRelativeForMake( mf->GetHomeDirectory()) << " -B" << this->ConvertToRelativeForMake( @@ -451,7 +451,7 @@ void cmGlobalXCodeGenerator::ClearXCodeObjects() } //---------------------------------------------------------------------------- -cmXCodeObject* +cmXCodeObject* cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::PBXType ptype) { cmXCodeObject* obj; @@ -468,7 +468,7 @@ cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::PBXType ptype) } //---------------------------------------------------------------------------- -cmXCodeObject* +cmXCodeObject* cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::Type type) { cmXCodeObject* obj = new cmXCodeObject(cmXCodeObject::None, type); @@ -539,7 +539,7 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, buildFile->SetComment(fileRef->GetComment()); buildFile->AddAttribute("fileRef", this->CreateObjectReference(fileRef)); - cmXCodeObject* settings = + cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); settings->AddAttribute("COMPILER_FLAGS", this->CreateString(flags.c_str())); @@ -608,7 +608,7 @@ cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf, } fileRef->AddAttribute("fileEncoding", this->CreateString("4")); - const char* lang = + const char* lang = this->CurrentLocalGenerator->GetSourceFileLanguage(*sf); std::string sourcecode = "sourcecode"; std::string ext = sf->GetExtension(); @@ -675,7 +675,7 @@ cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf, // // valid lastKnownFileType value. // } - fileRef->AddAttribute("lastKnownFileType", + fileRef->AddAttribute("lastKnownFileType", this->CreateString(sourcecode.c_str())); // Store the file path relative to the top of the source tree. @@ -717,7 +717,7 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen) std::string outdir = cmSystemTools::CollapseFullPath(this->CurrentMakefile-> GetCurrentOutputDirectory()); - cmSystemTools::SplitPath(outdir.c_str(), + cmSystemTools::SplitPath(outdir.c_str(), this->CurrentOutputDirectoryComponents); // Select the current set of configuration types. @@ -767,7 +767,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, this->CreateXCodeSourceFile(this->CurrentLocalGenerator, *i, cmtarget); cmXCodeObject* fr = xsf->GetObject("fileRef"); - cmXCodeObject* filetype = + cmXCodeObject* filetype = fr->GetObject()->GetObject("lastKnownFileType"); cmTarget::SourceFileFlags tsFlags = @@ -813,7 +813,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, sourceBuildPhase = this->CreateObject(cmXCodeObject::PBXSourcesBuildPhase); sourceBuildPhase->SetComment("Sources"); - sourceBuildPhase->AddAttribute("buildActionMask", + sourceBuildPhase->AddAttribute("buildActionMask", this->CreateString("2147483647")); buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); for(std::vector<cmXCodeObject*>::iterator i = sourceFiles.begin(); @@ -822,7 +822,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, buildFiles->AddObject(*i); } sourceBuildPhase->AddAttribute("files", buildFiles); - sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", this->CreateString("0")); } @@ -915,7 +915,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, for ( sfIt = mit->second.begin(); sfIt != mit->second.end(); ++ sfIt ) { cmXCodeObject* xsf = - this->CreateXCodeSourceFile(this->CurrentLocalGenerator, + this->CreateXCodeSourceFile(this->CurrentLocalGenerator, *sfIt, cmtarget); buildFiles->AddObject(xsf); } @@ -939,12 +939,12 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, { buildFiles->AddObject(*i); } - frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", this->CreateString("0")); } // create list of build phases and create the XCode target - cmXCodeObject* buildPhases = + cmXCodeObject* buildPhases = this->CreateObject(cmXCodeObject::OBJECT_LIST); this->CreateCustomCommands(buildPhases, sourceBuildPhase, @@ -1033,15 +1033,15 @@ cmGlobalXCodeGenerator::CreateBuildPhase(const char* name, { return 0; } - cmXCodeObject* buildPhase = + cmXCodeObject* buildPhase = this->CreateObject(cmXCodeObject::PBXShellScriptBuildPhase); buildPhase->AddAttribute("buildActionMask", this->CreateString("2147483647")); cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); buildPhase->AddAttribute("files", buildFiles); - buildPhase->AddAttribute("name", + buildPhase->AddAttribute("name", this->CreateString(name)); - buildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + buildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", this->CreateString("0")); buildPhase->AddAttribute("shellPath", this->CreateString("/bin/sh")); @@ -1064,16 +1064,16 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases, frameworkBuildPhase, cmTarget& cmtarget) { - std::vector<cmCustomCommand> const & prebuild + std::vector<cmCustomCommand> const & prebuild = cmtarget.GetPreBuildCommands(); - std::vector<cmCustomCommand> const & prelink + std::vector<cmCustomCommand> const & prelink = cmtarget.GetPreLinkCommands(); - std::vector<cmCustomCommand> const & postbuild + std::vector<cmCustomCommand> const & postbuild = cmtarget.GetPostBuildCommands(); std::vector<cmSourceFile*>const &classes = cmtarget.GetSourceFiles(); // add all the sources std::vector<cmCustomCommand> commands; - for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); + for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); i != classes.end(); ++i) { if((*i)->GetCustomCommand()) @@ -1082,7 +1082,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases, } } std::vector<cmCustomCommand> reruncom; - cmXCodeObject* cmakeReRunPhase = + cmXCodeObject* cmakeReRunPhase = this->CreateBuildPhase("CMake ReRun", "cmakeReRunPhase", cmtarget, reruncom); buildPhases->AddObject(cmakeReRunPhase); @@ -1092,15 +1092,15 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases, "cmakeRulesBuildPhase", cmtarget, commands); // create prebuild phase - cmXCodeObject* preBuildPhase = + cmXCodeObject* preBuildPhase = this->CreateBuildPhase("CMake PreBuild Rules", "preBuildCommands", cmtarget, prebuild); // create prelink phase - cmXCodeObject* preLinkPhase = + cmXCodeObject* preLinkPhase = this->CreateBuildPhase("CMake PreLink Rules", "preLinkCommands", cmtarget, prelink); // create postbuild phase - cmXCodeObject* postBuildPhase = + cmXCodeObject* postBuildPhase = this->CreateBuildPhase("CMake PostBuild Rules", "postBuildPhase", cmtarget, postbuild); @@ -1167,10 +1167,10 @@ std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag, } //---------------------------------------------------------------------------- -void +void cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, cmTarget& target, - std::vector<cmCustomCommand> + std::vector<cmCustomCommand> const & commands, const char* name) { @@ -1181,7 +1181,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, std::string makecmd = "make -C "; makecmd += cdir; makecmd += " -f "; - makecmd += + makecmd += this->ConvertToRelativeForMake(this->CurrentReRunCMakeMakefile.c_str()); cmSystemTools::ReplaceString(makecmd, "\\ ", "\\\\ "); buildphase->AddAttribute("shellScript", @@ -1195,7 +1195,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, for(std::vector<cmCustomCommand>::const_iterator i = commands.begin(); i != commands.end(); ++i) { - cmCustomCommand const& cc = *i; + cmCustomCommand const& cc = *i; if(!cc.GetCommandLines().empty()) { const std::vector<std::string>& outputs = cc.GetOutputs(); @@ -1213,7 +1213,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, } } } - + std::string dir = this->CurrentMakefile->GetCurrentOutputDirectory(); dir += "/CMakeScripts"; cmSystemTools::MakeDirectory(dir.c_str()); @@ -1223,19 +1223,19 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, makefile += "_"; makefile += name; makefile += ".make"; - - for (std::vector<std::string>::const_iterator currentConfig= + + for (std::vector<std::string>::const_iterator currentConfig= this->CurrentConfigurationTypes.begin(); currentConfig!=this->CurrentConfigurationTypes.end(); currentConfig++ ) { - this->CreateCustomRulesMakefile(makefile.c_str(), - target, - commands, + this->CreateCustomRulesMakefile(makefile.c_str(), + target, + commands, currentConfig->c_str(), multipleOutputPairs); } - + std::string cdir = this->CurrentMakefile->GetCurrentOutputDirectory(); cdir = this->ConvertToRelativeForXCode(cdir.c_str()); std::string makecmd = "make -C "; @@ -1249,18 +1249,18 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, } makecmd += " all"; cmSystemTools::ReplaceString(makecmd, "\\ ", "\\\\ "); - buildphase->AddAttribute("shellScript", + buildphase->AddAttribute("shellScript", this->CreateString(makecmd.c_str())); } //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator -::CreateCustomRulesMakefile(const char* makefileBasename, - cmTarget& target, - std::vector<cmCustomCommand> +::CreateCustomRulesMakefile(const char* makefileBasename, + cmTarget& target, + std::vector<cmCustomCommand> const & commands, const char* configName, - const std::map<cmStdString, + const std::map<cmStdString, cmStdString>& multipleOutputPairs ) { @@ -1277,7 +1277,7 @@ void cmGlobalXCodeGenerator makefileStream.SetCopyIfDifferent(true); makefileStream << "# Generated by CMake, DO NOT EDIT\n"; makefileStream << "# Custom rules for " << target.GetName() << "\n"; - + // have all depend on all outputs makefileStream << "all: "; std::map<const cmCustomCommand*, cmStdString> tname; @@ -1285,7 +1285,7 @@ void cmGlobalXCodeGenerator for(std::vector<cmCustomCommand>::const_iterator i = commands.begin(); i != commands.end(); ++i) { - cmCustomCommand const& cc = *i; + cmCustomCommand const& cc = *i; if(!cc.GetCommandLines().empty()) { const std::vector<std::string>& outputs = cc.GetOutputs(); @@ -1299,10 +1299,10 @@ void cmGlobalXCodeGenerator } } else - { + { cmOStringStream str; str << "_buildpart_" << count++ ; - tname[&cc] = std::string(target.GetName()) + str.str(); + tname[&cc] = std::string(target.GetName()) + str.str(); makefileStream << "\\\n\t" << tname[&cc]; } } @@ -1311,7 +1311,7 @@ void cmGlobalXCodeGenerator for(std::vector<cmCustomCommand>::const_iterator i = commands.begin(); i != commands.end(); ++i) { - cmCustomCommand const& cc = *i; + cmCustomCommand const& cc = *i; if(!cc.GetCommandLines().empty()) { bool escapeOldStyle = cc.GetEscapeOldStyle(); @@ -1330,7 +1330,7 @@ void cmGlobalXCodeGenerator // There are no outputs. Use the generated force rule name. makefileStream << tname[&cc] << ": "; } - for(std::vector<std::string>::const_iterator d = + for(std::vector<std::string>::const_iterator d = cc.GetDepends().begin(); d != cc.GetDepends().end(); ++d) { @@ -1351,7 +1351,7 @@ void cmGlobalXCodeGenerator } // Add each command line to the set of commands. - for(cmCustomCommandLines::const_iterator cl = + for(cmCustomCommandLines::const_iterator cl = cc.GetCommandLines().begin(); cl != cc.GetCommandLines().end(); ++cl) { @@ -1359,7 +1359,7 @@ void cmGlobalXCodeGenerator const cmCustomCommandLine& commandLine = *cl; std::string cmd2 = this->CurrentLocalGenerator ->GetRealLocation(commandLine[0].c_str(), configName); - + cmSystemTools::ReplaceString(cmd2, "/./", "/"); cmd2 = this->ConvertToRelativeForMake(cmd2.c_str()); std::string cmd; @@ -1393,7 +1393,7 @@ void cmGlobalXCodeGenerator // Add rules to deal with multiple outputs of custom commands. if(!multipleOutputPairs.empty()) { - makefileStream << + makefileStream << "\n# Dependencies of multiple outputs to their primary outputs \n"; for(std::map<cmStdString, cmStdString>::const_iterator o = @@ -1424,6 +1424,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, std::string defFlags; bool shared = ((target.GetType() == cmTarget::SHARED_LIBRARY) || (target.GetType() == cmTarget::MODULE_LIBRARY)); + bool binary = ((target.GetType() == cmTarget::STATIC_LIBRARY) || + (target.GetType() == cmTarget::EXECUTABLE) || + shared); const char* lang = target.GetLinkerLanguage(configName); std::string cflags; @@ -1438,10 +1441,17 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, // Add language-specific flags. this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName); - + // Add shared-library flags if needed. this->CurrentLocalGenerator->AddSharedFlags(flags, lang, shared); } + else if(binary) + { + cmSystemTools::Error + ("CMake can not determine linker language for target:", + target.GetName()); + return; + } // Add define flags this->CurrentLocalGenerator-> @@ -1476,11 +1486,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, std::string extraLinkOptions; if(target.GetType() == cmTarget::EXECUTABLE) { - extraLinkOptions = + extraLinkOptions = this->CurrentMakefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS"); std::string var = "CMAKE_EXE_LINKER_FLAGS_"; var += cmSystemTools::UpperCase(configName); - std::string val = + std::string val = this->CurrentMakefile->GetSafeDefinition(var.c_str()); if(val.size()) { @@ -1579,9 +1589,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, this->CreateString(pndir.c_str())); pndir = target.GetDirectory(configName); } - buildSettings->AddAttribute("EXECUTABLE_PREFIX", + buildSettings->AddAttribute("EXECUTABLE_PREFIX", this->CreateString(pnprefix.c_str())); - buildSettings->AddAttribute("EXECUTABLE_SUFFIX", + buildSettings->AddAttribute("EXECUTABLE_SUFFIX", this->CreateString(pnsuffix.c_str())); } buildSettings->AddAttribute("SYMROOT", @@ -1592,20 +1602,20 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, { case cmTarget::STATIC_LIBRARY: { - buildSettings->AddAttribute("LIBRARY_STYLE", + buildSettings->AddAttribute("LIBRARY_STYLE", this->CreateString("STATIC")); break; } - + case cmTarget::MODULE_LIBRARY: { - buildSettings->AddAttribute("LIBRARY_STYLE", + buildSettings->AddAttribute("LIBRARY_STYLE", this->CreateString("BUNDLE")); if(this->XcodeVersion >= 22) { - buildSettings->AddAttribute("MACH_O_TYPE", + buildSettings->AddAttribute("MACH_O_TYPE", this->CreateString("mh_bundle")); - buildSettings->AddAttribute("GCC_DYNAMIC_NO_PIC", + buildSettings->AddAttribute("GCC_DYNAMIC_NO_PIC", this->CreateString("NO")); // Add the flags to create an executable. std::string createFlags = @@ -1690,7 +1700,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, plist.c_str()); std::string path = this->ConvertToRelativeForXCode(plist.c_str()); - buildSettings->AddAttribute("INFOPLIST_FILE", + buildSettings->AddAttribute("INFOPLIST_FILE", this->CreateString(path.c_str())); } @@ -1701,7 +1711,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } if(this->XcodeVersion >= 22) { - buildSettings->AddAttribute("PREBINDING", + buildSettings->AddAttribute("PREBINDING", this->CreateString("NO")); } @@ -1726,7 +1736,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } else { - std::string incpath = + std::string incpath = this->XCodeEscapePath(i->c_str()); dirs.Add(incpath.c_str()); } @@ -1745,12 +1755,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } if(!fdirs.IsEmpty()) { - buildSettings->AddAttribute("FRAMEWORK_SEARCH_PATHS", + buildSettings->AddAttribute("FRAMEWORK_SEARCH_PATHS", fdirs.CreateList()); } if(!dirs.IsEmpty()) { - buildSettings->AddAttribute("HEADER_SEARCH_PATHS", + buildSettings->AddAttribute("HEADER_SEARCH_PATHS", dirs.CreateList()); } std::string oflagc = this->ExtractFlag("-O", cflags); @@ -1792,11 +1802,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, if(gflagc.size() ==0 && gflag.size() == 0) { debugStr = "NO"; - } + } buildSettings->AddAttribute("GCC_GENERATE_DEBUGGING_SYMBOLS", this->CreateString(debugStr)); - buildSettings->AddAttribute("GCC_OPTIMIZATION_LEVEL", + buildSettings->AddAttribute("GCC_OPTIMIZATION_LEVEL", this->CreateString(optLevel)); buildSettings->AddAttribute("GCC_SYMBOLS_PRIVATE_EXTERN", this->CreateString("NO")); @@ -1806,11 +1816,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, { flags += " "; flags += defFlags; - buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS", + buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS", this->CreateString(flags.c_str())); cflags += " "; cflags += defFlags; - buildSettings->AddAttribute("OTHER_CFLAGS", + buildSettings->AddAttribute("OTHER_CFLAGS", this->CreateString(cflags.c_str())); } @@ -1818,7 +1828,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, { flags += " "; flags += defFlags; - buildSettings->AddAttribute("OTHER_CFLAGS", + buildSettings->AddAttribute("OTHER_CFLAGS", this->CreateString(flags.c_str())); } @@ -1846,9 +1856,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, buildSettings->AddAttribute("INSTALL_PATH", this->CreateString(install_name_dir.c_str())); - buildSettings->AddAttribute("OTHER_LDFLAGS", + buildSettings->AddAttribute("OTHER_LDFLAGS", this->CreateString(extraLinkOptions.c_str())); - buildSettings->AddAttribute("OTHER_REZFLAGS", + buildSettings->AddAttribute("OTHER_REZFLAGS", this->CreateString("")); buildSettings->AddAttribute("SECTORDER_FLAGS", this->CreateString("")); @@ -1918,12 +1928,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } //---------------------------------------------------------------------------- -cmXCodeObject* +cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget) { cmXCodeObject* shellBuildPhase = this->CreateObject(cmXCodeObject::PBXShellScriptBuildPhase); - shellBuildPhase->AddAttribute("buildActionMask", + shellBuildPhase->AddAttribute("buildActionMask", this->CreateString("2147483647")); cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); shellBuildPhase->AddAttribute("files", buildFiles); @@ -1938,10 +1948,10 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget) shellBuildPhase->AddAttribute("shellScript", this->CreateString( "# shell script goes here\nexit 0")); - cmXCodeObject* target = + cmXCodeObject* target = this->CreateObject(cmXCodeObject::PBXAggregateTarget); target->SetComment(cmtarget.GetName()); - cmXCodeObject* buildPhases = + cmXCodeObject* buildPhases = this->CreateObject(cmXCodeObject::OBJECT_LIST); std::vector<cmXCodeObject*> emptyContentVector; this->CreateCustomCommands(buildPhases, 0, 0, 0, emptyContentVector, 0, @@ -1960,7 +1970,7 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget) this->CreateBuildSettings(cmtarget, buildSettings, theConfig); target->AddAttribute("buildSettings", buildSettings); } - cmXCodeObject* dependencies = + cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST); target->AddAttribute("dependencies", dependencies); target->AddAttribute("name", this->CreateString(cmtarget.GetName())); @@ -1988,13 +1998,13 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget) std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target, cmTarget& cmtarget) { - std::string configTypes = + std::string configTypes = this->CurrentMakefile->GetRequiredDefinition("CMAKE_CONFIGURATION_TYPES"); std::vector<std::string> configVectorIn; std::vector<std::string> configVector; configVectorIn.push_back(configTypes); cmSystemTools::ExpandList(configVectorIn, configVector); - cmXCodeObject* configlist = + cmXCodeObject* configlist = this->CreateObject(cmXCodeObject::XCConfigurationList); cmXCodeObject* buildConfigurations = this->CreateObject(cmXCodeObject::OBJECT_LIST); @@ -2005,11 +2015,11 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target, comment += cmtarget.GetName(); comment += "\""; configlist->SetComment(comment.c_str()); - target->AddAttribute("buildConfigurationList", + target->AddAttribute("buildConfigurationList", this->CreateObjectReference(configlist)); for(unsigned int i = 0; i < configVector.size(); ++i) { - cmXCodeObject* config = + cmXCodeObject* config = this->CreateObject(cmXCodeObject::XCBuildConfiguration); buildConfigurations->AddObject(config); cmXCodeObject* buildSettings = @@ -2022,9 +2032,9 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target, } if(configVector.size()) { - configlist->AddAttribute("defaultConfigurationName", + configlist->AddAttribute("defaultConfigurationName", this->CreateString(configVector[0].c_str())); - configlist->AddAttribute("defaultConfigurationIsVisible", + configlist->AddAttribute("defaultConfigurationIsVisible", this->CreateString("0")); return configVector[0]; } @@ -2079,7 +2089,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget, cmXCodeObject* buildPhases) { - cmXCodeObject* target = + cmXCodeObject* target = this->CreateObject(cmXCodeObject::PBXNativeTarget); target->AddAttribute("buildPhases", buildPhases); cmXCodeObject* buildRules = this->CreateObject(cmXCodeObject::OBJECT_LIST); @@ -2097,13 +2107,13 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget, this->CreateBuildSettings(cmtarget, buildSettings, defConfig.c_str()); target->AddAttribute("buildSettings", buildSettings); } - cmXCodeObject* dependencies = + cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST); target->AddAttribute("dependencies", dependencies); target->AddAttribute("name", this->CreateString(cmtarget.GetName())); target->AddAttribute("productName",this->CreateString(cmtarget.GetName())); - cmXCodeObject* fileRef = + cmXCodeObject* fileRef = this->CreateObject(cmXCodeObject::PBXFileReference); if(const char* fileType = this->GetTargetFileType(cmtarget)) { @@ -2115,7 +2125,7 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget, fileRef->AddAttribute("sourceTree", this->CreateString("BUILT_PRODUCTS_DIR")); fileRef->SetComment(cmtarget.GetName()); - target->AddAttribute("productReference", + target->AddAttribute("productReference", this->CreateObjectReference(fileRef)); if(const char* productType = this->GetTargetProductType(cmtarget)) { @@ -2156,20 +2166,20 @@ void cmGlobalXCodeGenerator::AddDependTarget(cmXCodeObject* target, // now avoid circular references if dependTarget already // depends on target then skip it. Circular references crashes // xcode - cmXCodeObject* dependTargetDepends = + cmXCodeObject* dependTargetDepends = dependTarget->GetObject("dependencies"); if(dependTargetDepends) { if(dependTargetDepends->HasObject(target->GetPBXTargetDependency())) - { + { return; } } - + cmXCodeObject* targetdep = dependTarget->GetPBXTargetDependency(); if(!targetdep) { - cmXCodeObject* container = + cmXCodeObject* container = this->CreateObject(cmXCodeObject::PBXContainerItemProxy); container->SetComment("PBXContainerItemProxy"); container->AddAttribute("containerPortal", @@ -2177,25 +2187,25 @@ void cmGlobalXCodeGenerator::AddDependTarget(cmXCodeObject* target, container->AddAttribute("proxyType", this->CreateString("1")); container->AddAttribute("remoteGlobalIDString", this->CreateObjectReference(dependTarget)); - container->AddAttribute("remoteInfo", + container->AddAttribute("remoteInfo", this->CreateString( dependTarget->GetTarget()->GetName())); - targetdep = + targetdep = this->CreateObject(cmXCodeObject::PBXTargetDependency); targetdep->SetComment("PBXTargetDependency"); targetdep->AddAttribute("target", this->CreateObjectReference(dependTarget)); - targetdep->AddAttribute("targetProxy", + targetdep->AddAttribute("targetProxy", this->CreateObjectReference(container)); dependTarget->SetPBXTargetDependency(targetdep); } - + cmXCodeObject* depends = target->GetObject("dependencies"); if(!depends) { cmSystemTools:: Error("target does not have dependencies attribute error.."); - + } else { @@ -2243,14 +2253,14 @@ void cmGlobalXCodeGenerator { // There are multiple configurations. Add the setting to the // buildSettings of the configuration name given. - cmXCodeObject* configurationList = + cmXCodeObject* configurationList = target->GetObject("buildConfigurationList")->GetObject(); - cmXCodeObject* buildConfigs = + cmXCodeObject* buildConfigs = configurationList->GetObject("buildConfigurations"); std::vector<cmXCodeObject*> list = buildConfigs->GetObjectList(); - // each configuration and the target itself has a buildSettings in it + // each configuration and the target itself has a buildSettings in it //list.push_back(target); - for(std::vector<cmXCodeObject*>::iterator i = list.begin(); + for(std::vector<cmXCodeObject*>::iterator i = list.begin(); i != list.end(); ++i) { if(configName) @@ -2412,7 +2422,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups(); cmTargets &tgts = mf->GetTargets(); for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) - { + { cmTarget& cmtarget = l->second; // Same skipping logic here as in CreateXCodeTargets so that we do not @@ -2435,21 +2445,21 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, std::vector<cmSourceFile*> classes = cmtarget.GetSourceFiles(); - for(std::vector<cmSourceFile*>::const_iterator s = classes.begin(); + for(std::vector<cmSourceFile*>::const_iterator s = classes.begin(); s != classes.end(); s++) { cmSourceFile* sf = *s; // Add the file to the list of sources. std::string const& source = sf->GetFullPath(); - cmSourceGroup& sourceGroup = + cmSourceGroup& sourceGroup = mf->FindSourceGroup(source.c_str(), sourceGroups); - cmXCodeObject* pbxgroup = + cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(cmtarget, &sourceGroup); cmStdString key = GetGroupMapKey(cmtarget, sf); this->GroupMap[key] = pbxgroup; } } - } + } } //---------------------------------------------------------------------------- @@ -2475,7 +2485,7 @@ cmXCodeObject* cmGlobalXCodeGenerator { tgroup = this->CreateObject(cmXCodeObject::PBXGroup); this->TargetGroup[cmtarget.GetName()] = tgroup; - cmXCodeObject* tgroupChildren = + cmXCodeObject* tgroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST); tgroup->AddAttribute("name", this->CreateString(cmtarget.GetName())); tgroup->AddAttribute("children", tgroupChildren); @@ -2498,7 +2508,7 @@ cmXCodeObject* cmGlobalXCodeGenerator cmXCodeObject* tgroupChildren = tgroup->GetObject("children"); cmXCodeObject* group = this->CreateObject(cmXCodeObject::PBXGroup); - cmXCodeObject* groupChildren = + cmXCodeObject* groupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST); group->AddAttribute("name", this->CreateString(sg->GetName())); group->AddAttribute("children", groupChildren); @@ -2518,19 +2528,19 @@ void cmGlobalXCodeGenerator std::vector<cmLocalGenerator*>& generators) { - this->ClearXCodeObjects(); + this->ClearXCodeObjects(); this->RootObject = 0; this->SourcesGroupChildren = 0; this->ResourcesGroupChildren = 0; this->MainGroupChildren = 0; cmXCodeObject* group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO")); - cmXCodeObject* developBuildStyle = + cmXCodeObject* developBuildStyle = this->CreateObject(cmXCodeObject::PBXBuildStyle); cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::OBJECT_LIST); if(this->XcodeVersion == 15) { - developBuildStyle->AddAttribute("name", + developBuildStyle->AddAttribute("name", this->CreateString("Development")); developBuildStyle->AddAttribute("buildSettings", group); listObjs->AddObject(developBuildStyle); @@ -2546,7 +2556,7 @@ void cmGlobalXCodeGenerator { for(unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) { - cmXCodeObject* buildStyle = + cmXCodeObject* buildStyle = this->CreateObject(cmXCodeObject::PBXBuildStyle); const char* name = this->CurrentConfigurationTypes[i].c_str(); buildStyle->AddAttribute("name", this->CreateString(name)); @@ -2560,7 +2570,7 @@ void cmGlobalXCodeGenerator } cmXCodeObject* mainGroup = this->CreateObject(cmXCodeObject::PBXGroup); - this->MainGroupChildren = + this->MainGroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST); mainGroup->AddAttribute("children", this->MainGroupChildren); if(this->XcodeVersion == 15) @@ -2570,7 +2580,7 @@ void cmGlobalXCodeGenerator mainGroup->AddAttribute("sourceTree", this->CreateString("<group>")); cmXCodeObject* sourcesGroup = this->CreateObject(cmXCodeObject::PBXGroup); - this->SourcesGroupChildren = + this->SourcesGroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST); sourcesGroup->AddAttribute("name", this->CreateString("Sources")); sourcesGroup->AddAttribute("children", this->SourcesGroupChildren); @@ -2593,7 +2603,7 @@ void cmGlobalXCodeGenerator resourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>")); this->MainGroupChildren->AddObject(resourcesGroup); - // now create the cmake groups + // now create the cmake groups this->CreateGroups(root, generators); cmXCodeObject* productGroup = this->CreateObject(cmXCodeObject::PBXGroup); @@ -2603,16 +2613,16 @@ void cmGlobalXCodeGenerator productGroup->AddAttribute("refType", this->CreateString("4")); } productGroup->AddAttribute("sourceTree", this->CreateString("<group>")); - cmXCodeObject* productGroupChildren = + cmXCodeObject* productGroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST); productGroup->AddAttribute("children", productGroupChildren); this->MainGroupChildren->AddObject(productGroup); - - + + this->RootObject = this->CreateObject(cmXCodeObject::PBXProject); this->RootObject->SetComment("Project object"); group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); - this->RootObject->AddAttribute("mainGroup", + this->RootObject->AddAttribute("mainGroup", this->CreateObjectReference(mainGroup)); this->RootObject->AddAttribute("buildSettings", group); this->RootObject->AddAttribute("buildStyles", listObjs); @@ -2639,18 +2649,18 @@ void cmGlobalXCodeGenerator this->CreateString(pdir.c_str())); this->RootObject->AddAttribute("projectRoot", this->CreateString("")); } - cmXCodeObject* configlist = + cmXCodeObject* configlist = this->CreateObject(cmXCodeObject::XCConfigurationList); cmXCodeObject* buildConfigurations = this->CreateObject(cmXCodeObject::OBJECT_LIST); std::vector<cmXCodeObject*> configs; if(this->XcodeVersion == 15) { - cmXCodeObject* configDebug = + cmXCodeObject* configDebug = this->CreateObject(cmXCodeObject::XCBuildConfiguration); configDebug->AddAttribute("name", this->CreateString("Debug")); configs.push_back(configDebug); - cmXCodeObject* configRelease = + cmXCodeObject* configRelease = this->CreateObject(cmXCodeObject::XCBuildConfiguration); configRelease->AddAttribute("name", this->CreateString("Release")); configs.push_back(configRelease); @@ -2660,7 +2670,7 @@ void cmGlobalXCodeGenerator for(unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) { const char* name = this->CurrentConfigurationTypes[i].c_str(); - cmXCodeObject* config = + cmXCodeObject* config = this->CreateObject(cmXCodeObject::XCBuildConfiguration); config->AddAttribute("name", this->CreateString(name)); configs.push_back(config); @@ -2678,13 +2688,13 @@ void cmGlobalXCodeGenerator comment += this->CurrentProject; comment += "\""; configlist->SetComment(comment.c_str()); - configlist->AddAttribute("defaultConfigurationIsVisible", + configlist->AddAttribute("defaultConfigurationIsVisible", this->CreateString("0")); - configlist->AddAttribute("defaultConfigurationName", + configlist->AddAttribute("defaultConfigurationName", this->CreateString("Debug")); cmXCodeObject* buildSettings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); - const char* osxArch = + const char* osxArch = this->CurrentMakefile->GetDefinition("CMAKE_OSX_ARCHITECTURES"); if(strlen(osxArch) == 0) { @@ -2709,11 +2719,11 @@ void cmGlobalXCodeGenerator this->CreateString("YES")); } - const char* sysroot = + const char* sysroot = this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT"); - const char* sysrootDefault = + const char* sysrootDefault = this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT"); - const char* deploymentTarget = + const char* deploymentTarget = this->CurrentMakefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); if(osxArch && sysroot) { @@ -2723,11 +2733,11 @@ void cmGlobalXCodeGenerator cmSystemTools::ExpandListArgument(std::string(osxArch), this->Architectures); flagsUsed = true; - buildSettings->AddAttribute("SDKROOT", + buildSettings->AddAttribute("SDKROOT", this->CreateString(sysroot)); std::string archString; const char* sep = ""; - for( std::vector<std::string>::iterator i = + for( std::vector<std::string>::iterator i = this->Architectures.begin(); i != this->Architectures.end(); ++i) { @@ -2735,12 +2745,12 @@ void cmGlobalXCodeGenerator archString += *i; sep = " "; } - buildSettings->AddAttribute("ARCHS", + buildSettings->AddAttribute("ARCHS", this->CreateString(archString.c_str())); if(!flagsUsed && sysrootDefault && strcmp(sysroot, sysrootDefault) != 0) { - buildSettings->AddAttribute("SDKROOT", + buildSettings->AddAttribute("SDKROOT", this->CreateString(sysroot)); } } @@ -2776,7 +2786,7 @@ void cmGlobalXCodeGenerator (*i)->AddAttribute("buildSettings", buildSettings); } - this->RootObject->AddAttribute("buildConfigurationList", + this->RootObject->AddAttribute("buildConfigurationList", this->CreateObjectReference(configlist)); std::vector<cmXCodeObject*> targets; @@ -2801,7 +2811,7 @@ void cmGlobalXCodeGenerator cmXCodeObject* allTargets = this->CreateObject(cmXCodeObject::OBJECT_LIST); for(std::vector<cmXCodeObject*>::iterator i = targets.begin(); i != targets.end(); ++i) - { + { cmXCodeObject* t = *i; allTargets->AddObject(t); cmXCodeObject* productRef = t->GetObject("productReference"); @@ -2814,11 +2824,11 @@ void cmGlobalXCodeGenerator } //---------------------------------------------------------------------------- -void +void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( std::vector<cmXCodeObject*>& targets) -{ - cmGeneratedFileStream +{ + cmGeneratedFileStream makefileStream(this->CurrentXCodeHackMakefile.c_str()); if(!makefileStream) { @@ -2864,9 +2874,9 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( this->ConvertToRelativeForMake(tfull.c_str()); } } - makefileStream << "\n\n"; + makefileStream << "\n\n"; } - makefileStream + makefileStream << "# For each target create a dummy rule " "so the target does not have to exist\n"; std::set<cmStdString> emitted; @@ -2876,7 +2886,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( cmXCodeObject* target = *i; std::map<cmStdString, cmXCodeObject::StringVec> const& deplibs = target->GetDependLibraries(); - for(std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator ci + for(std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator ci = deplibs.begin(); ci != deplibs.end(); ++ci) { for(cmXCodeObject::StringVec::const_iterator d = ci->second.begin(); @@ -2884,7 +2894,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( { if(emitted.insert(*d).second) { - makefileStream << + makefileStream << this->ConvertToRelativeForMake(d->c_str()) << ":\n"; } } @@ -2893,10 +2903,10 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( makefileStream << "\n\n"; // Write rules to help Xcode relink things at the right time. - makefileStream << + makefileStream << "# Rules to remove targets that are older than anything to which they\n" "# link. This forces Xcode to relink the targets from scratch. It\n" - "# does not seem to check these dependencies itself.\n"; + "# does not seem to check these dependencies itself.\n"; for(std::vector<std::string>::const_iterator ct = this->CurrentConfigurationTypes.begin(); ct != this->CurrentConfigurationTypes.end(); ++ct) @@ -2917,7 +2927,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( { // Create a rule for this target. std::string tfull = t->GetFullPath(configName); - makefileStream << this->ConvertToRelativeForMake(tfull.c_str()) + makefileStream << this->ConvertToRelativeForMake(tfull.c_str()) << ":"; // List dependencies if any exist. @@ -2929,7 +2939,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( for(std::vector<cmStdString>::const_iterator d = deplibs.begin(); d != deplibs.end(); ++d) { - makefileStream << "\\\n\t" << + makefileStream << "\\\n\t" << this->ConvertToRelativeForMake(d->c_str()); } } @@ -2951,7 +2961,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( universal += "/"; universal += t->GetName(); universal += ".build/Objects-normal/"; - for( std::vector<std::string>::iterator arch = + for( std::vector<std::string>::iterator arch = this->Architectures.begin(); arch != this->Architectures.end(); ++arch) { @@ -2960,7 +2970,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( universalFile += "/"; universalFile += t->GetFullName(configName); makefileStream << "\t/bin/rm -f " - << + << this->ConvertToRelativeForMake(universalFile.c_str()) << "\n"; } @@ -2974,7 +2984,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root, - std::vector<cmLocalGenerator*>& + std::vector<cmLocalGenerator*>& generators) { if(generators.size() == 0) @@ -3014,7 +3024,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root, } //---------------------------------------------------------------------------- -void +void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* , std::vector<cmLocalGenerator*>& ) @@ -3072,7 +3082,7 @@ std::string cmGlobalXCodeGenerator::ConvertToRelativeForMake(const char* p) } else { - std::string ret = + std::string ret = this->CurrentLocalGenerator-> ConvertToRelativePath(this->CurrentOutputDirectoryComponents, p); return cmSystemTools::ConvertToOutputPath(ret.c_str()); @@ -3088,7 +3098,7 @@ std::string cmGlobalXCodeGenerator::ConvertToRelativeForXCode(const char* p) } else { - std::string ret = + std::string ret = this->CurrentLocalGenerator-> ConvertToRelativePath(this->ProjectOutputDirectoryComponents, p); return cmSystemTools::ConvertToOutputPath(ret.c_str()); @@ -3128,7 +3138,7 @@ std::string cmGlobalXCodeGenerator::XCodeEscapePath(const char* p) //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator:: GetTargetObjectFileDirectories(cmTarget* target, - std::vector<std::string>& + std::vector<std::string>& dirs) { std::string dir = this->CurrentMakefile->GetCurrentOutputDirectory(); @@ -3142,7 +3152,7 @@ GetTargetObjectFileDirectories(cmTarget* target, std::string dirsave = dir; if(this->Architectures.size()) { - for(std::vector<std::string>::iterator i = this->Architectures.begin(); + for(std::vector<std::string>::iterator i = this->Architectures.begin(); i != this->Architectures.end(); ++i) { dir += *i; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e32619a..56e0ed9 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -900,6 +900,14 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs, // Construct a rule file associated with the first output produced. std::string outName = outputs[0]; outName += ".rule"; + const char* dir = + this->LocalGenerator->GetGlobalGenerator()-> + GetCMakeCFGInitDirectory(); + if(dir && dir[0] == '$') + { + cmSystemTools::ReplaceString(outName, dir, + cmake::GetCMakeFilesDirectory()); + } // Check if the rule file already exists. file = this->GetSource(outName.c_str()); if(file && file->GetCustomCommand() && !replace) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 3ee329f..5380257 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -834,12 +834,16 @@ void cmTarget::DefineProperties(cmake *cm) "executable with the TARGET_LINK_LIBRARIES command. " "On all platforms a target-level dependency on the executable is " "created for targets that link to it. " - "For non-DLL platforms the link rule is simply ignored since " - "the dynamic loader will automatically bind symbols when the " - "module is loaded. " "For DLL platforms an import library will be created for the " "exported symbols and then used for linking. " - "All Windows-based systems including Cygwin are DLL platforms."); + "All Windows-based systems including Cygwin are DLL platforms. " + "For non-DLL platforms that require all symbols to be resolved at " + "link time, such as Mac OS X, the module will \"link\" to the " + "executable using a flag like \"-bundle_loader\". " + "For other non-DLL platforms the link rule is simply ignored since " + "the dynamic loader will automatically bind symbols when the " + "module is loaded. " + ); cm->DefineProperty ("Fortran_MODULE_DIRECTORY", cmProperty::TARGET, diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 8dfafff..524be8b 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -32,6 +32,30 @@ static std::string cmVS10EscapeXML(std::string arg) return arg; } +static std::string cmVS10EscapeComment(std::string comment) +{ + // MSBuild takes the CDATA of a <Message></Message> element and just + // does "echo $CDATA" with no escapes. We must encode the string. + // http://technet.microsoft.com/en-us/library/cc772462%28WS.10%29.aspx + std::string echoable; + for(std::string::iterator c = comment.begin(); c != comment.end(); ++c) + { + switch (*c) + { + case '\r': break; + case '\n': echoable += '\t'; break; + case '"': /* no break */ + case '|': /* no break */ + case '&': /* no break */ + case '<': /* no break */ + case '>': /* no break */ + case '^': echoable += '^'; /* no break */ + default: echoable += *c; break; + } + } + return echoable; +} + cmVisualStudio10TargetGenerator:: cmVisualStudio10TargetGenerator(cmTarget* target, cmGlobalVisualStudio10Generator* gg) @@ -125,7 +149,10 @@ void cmVisualStudio10TargetGenerator::Generate() ".vcxproj"); if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY) { - this->ComputeClOptions(); + if(!this->ComputeClOptions()) + { + return; + } } cmMakefile* mf = this->Target->GetMakefile(); std::string path = mf->GetStartOutputDirectory(); @@ -325,6 +352,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, } cmLocalVisualStudio7Generator* lg = this->LocalGenerator; std::string comment = lg->ConstructComment(command); + comment = cmVS10EscapeComment(comment); std::vector<std::string> *configs = static_cast<cmGlobalVisualStudio7Generator *> (this->GlobalGenerator)->GetConfigurations(); @@ -347,7 +375,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, command.GetEscapeAllowMakeVars()) ); this->WritePlatformConfigTag("Message",i->c_str(), 3); - (*this->BuildFileStream ) << comment << "</Message>\n"; + (*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "</Message>\n"; this->WritePlatformConfigTag("Command", i->c_str(), 3); (*this->BuildFileStream ) << script << "</Command>\n"; this->WritePlatformConfigTag("AdditionalInputs", i->c_str(), 3); @@ -949,19 +977,23 @@ OutputLinkIncremental(std::string const& configName) } //---------------------------------------------------------------------------- -void cmVisualStudio10TargetGenerator::ComputeClOptions() +bool cmVisualStudio10TargetGenerator::ComputeClOptions() { std::vector<std::string> const* configs = this->GlobalGenerator->GetConfigurations(); for(std::vector<std::string>::const_iterator i = configs->begin(); i != configs->end(); ++i) { - this->ComputeClOptions(*i); + if(!this->ComputeClOptions(*i)) + { + return false; + } } + return true; } //---------------------------------------------------------------------------- -void cmVisualStudio10TargetGenerator::ComputeClOptions( +bool cmVisualStudio10TargetGenerator::ComputeClOptions( std::string const& configName) { // much of this was copied from here: @@ -984,7 +1016,7 @@ void cmVisualStudio10TargetGenerator::ComputeClOptions( cmSystemTools::Error ("CMake can not determine linker language for target:", this->Name.c_str()); - return; + return false; } if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0 || strcmp(linkLanguage, "Fortran") == 0) @@ -1044,6 +1076,7 @@ void cmVisualStudio10TargetGenerator::ComputeClOptions( } this->ClOptions[configName] = pOptions.release(); + return true; } //---------------------------------------------------------------------------- @@ -1433,8 +1466,9 @@ void cmVisualStudio10TargetGenerator::WriteEvent( command.GetEscapeAllowMakeVars()) ); } + comment = cmVS10EscapeComment(comment); this->WriteString("<Message>",3); - (*this->BuildFileStream ) << comment << "</Message>\n"; + (*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "</Message>\n"; this->WriteString("<Command>", 3); (*this->BuildFileStream ) << script; (*this->BuildFileStream ) << "</Command>" << "\n"; @@ -1445,10 +1479,13 @@ void cmVisualStudio10TargetGenerator::WriteEvent( void cmVisualStudio10TargetGenerator::WriteProjectReferences() { - cmGlobalGenerator::TargetDependSet const& depends + cmGlobalGenerator::TargetDependSet const& unordered = this->GlobalGenerator->GetTargetDirectDepends(*this->Target); + typedef cmGlobalVisualStudioGenerator::OrderedTargetDependSet + OrderedTargetDependSet; + OrderedTargetDependSet depends(unordered); this->WriteString("<ItemGroup>\n", 1); - for( cmGlobalGenerator::TargetDependSet::const_iterator i = depends.begin(); + for( OrderedTargetDependSet::const_iterator i = depends.begin(); i != depends.end(); ++i) { cmTarget* dt = *i; diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 64b2361..c3c27f4 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -50,8 +50,8 @@ private: void WriteObjSources(); void WritePathAndIncrementalLinkOptions(); void WriteItemDefinitionGroups(); - void ComputeClOptions(); - void ComputeClOptions(std::string const& configName); + bool ComputeClOptions(); + bool ComputeClOptions(std::string const& configName); void WriteClOptions(std::string const& config, std::vector<std::string> const & includes); void WriteRCOptions(std::string const& config, diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 1e3b018..2ebd165 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -3504,7 +3504,7 @@ void cmake::DefineProperties(cmake *cm) cm->DefineProperty ("USE_FOLDERS", cmProperty::GLOBAL, "Use the FOLDER target property to organize targets into folders.", - "If not set, CMake treats this property as ON by default. " + "If not set, CMake treats this property as OFF by default. " "CMake generators that are capable of organizing into a " "hierarchy of folders use the values of the FOLDER target " "property to name those folders. See also the documentation " diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 98fc895..d2b91d0 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -15,7 +15,7 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) # KWSys version date month component. Format is MM. -SET(KWSYS_DATE_STAMP_MONTH 09) +SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 28) +SET(KWSYS_DATE_STAMP_DAY 19) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5e88b5c..c056e86 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -153,6 +153,9 @@ IF(BUILD_TESTING) ADD_TEST_MACRO(ExportImport ExportImport) ADD_TEST_MACRO(Unset Unset) ADD_TEST_MACRO(PolicyScope PolicyScope) + ADD_TEST_MACRO(EmptyLibrary EmptyLibrary) + SET_TESTS_PROPERTIES(EmptyLibrary PROPERTIES + PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target:test") ADD_TEST_MACRO(CrossCompile CrossCompile) SET_TESTS_PROPERTIES(CrossCompile PROPERTIES PASS_REGULAR_EXPRESSION "TRY_RUN.. invoked in cross-compiling mode") diff --git a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt index 7206f1d..8095a1c 100644 --- a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt +++ b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt @@ -76,7 +76,8 @@ endif() file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cxx" - "int main() { return 0; }" + "int main() { return 0; } +" ) add_executable( diff --git a/Tests/EmptyLibrary/CMakeLists.txt b/Tests/EmptyLibrary/CMakeLists.txt new file mode 100644 index 0000000..baddbbf --- /dev/null +++ b/Tests/EmptyLibrary/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.6) +project(TestEmptyLibrary) + +add_subdirectory(subdir) diff --git a/Tests/EmptyLibrary/subdir/CMakeLists.txt b/Tests/EmptyLibrary/subdir/CMakeLists.txt new file mode 100644 index 0000000..e273f8d --- /dev/null +++ b/Tests/EmptyLibrary/subdir/CMakeLists.txt @@ -0,0 +1 @@ +add_library(test test.h) diff --git a/Tests/EmptyLibrary/subdir/test.h b/Tests/EmptyLibrary/subdir/test.h new file mode 100644 index 0000000..8511f53 --- /dev/null +++ b/Tests/EmptyLibrary/subdir/test.h @@ -0,0 +1 @@ +extern int dummy; diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index bf90a52..a878194 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -7,6 +7,13 @@ find_package(CVS) find_package(Subversion) find_package(Git) +option(ExternalProjectTest_USE_FOLDERS "Enable folder grouping in IDEs." ON) +if(ExternalProjectTest_USE_FOLDERS) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +else() + set_property(GLOBAL PROPERTY USE_FOLDERS OFF) +endif() + set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakePredefinedTargets-in-ExternalProjectTest") @@ -61,6 +68,15 @@ ExternalProject_Add(${proj} INSTALL_COMMAND "" ) +set(proj TargetNameSameAsFolder) +ExternalProject_Add(${proj} + BUILD_COMMAND "" + CONFIGURE_COMMAND "" + DOWNLOAD_COMMAND "" + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "${proj}") + set(proj MinimalNoOpProject) ExternalProject_Add(${proj} BUILD_COMMAND "" |