diff options
26 files changed, 216 insertions, 595 deletions
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 99c782d..2311ac8 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -61,6 +61,7 @@ Variables that Provide Information /variable/CMAKE_TWEAK_VERSION /variable/CMAKE_VERBOSE_MAKEFILE /variable/CMAKE_VERSION + /variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION /variable/CMAKE_VS_PLATFORM_TOOLSET /variable/CMAKE_XCODE_PLATFORM_TOOLSET /variable/PROJECT_BINARY_DIR diff --git a/Help/policy/CMP0024.rst b/Help/policy/CMP0024.rst index ce0b2e6..4c8c714 100644 --- a/Help/policy/CMP0024.rst +++ b/Help/policy/CMP0024.rst @@ -17,6 +17,6 @@ The OLD behavior for this policy is to allow including the result of an export() command. The NEW behavior for this policy is to not to allow including the result of an export() command. -This policy was introduced in CMake version 2.8.13. CMake version +This policy was introduced in CMake version 3.0.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. diff --git a/Help/policy/CMP0025.rst b/Help/policy/CMP0025.rst index 25957e9..fbb9b5e 100644 --- a/Help/policy/CMP0025.rst +++ b/Help/policy/CMP0025.rst @@ -3,12 +3,12 @@ CMP0025 Compiler id for Apple Clang is now AppleClang. -CMake >= 2.8.13 recognize that Apple Clang is a different compiler +CMake >= 3.0.0 recognize that Apple Clang is a different compiler than upstream Clang and that they have different version numbers. CMake now prefers to present this to projects by setting CMAKE_<LANG>_COMPILER_ID to "AppleClang" instead of "Clang". However, existing projects may assume the compiler id for Apple Clang is just -"Clang" as it was in CMake < 2.8.13. Therefore this policy determines +"Clang" as it was in CMake < 3.0.0. Therefore this policy determines for Apple Clang which compiler id to report in CMAKE_<LANG>_COMPILER_ID after <LANG> is enabled by the project() or enable_language() command. @@ -16,6 +16,6 @@ enable_language() command. The OLD behavior for this policy is to use compiler id "Clang". The NEW behavior for this policy is to use compiler id "AppleClang". -This policy was introduced in CMake version 2.8.13. CMake version +This policy was introduced in CMake version 3.0.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. diff --git a/Help/policy/CMP0026.rst b/Help/policy/CMP0026.rst index 585da56..d3079dc 100644 --- a/Help/policy/CMP0026.rst +++ b/Help/policy/CMP0026.rst @@ -20,6 +20,6 @@ The OLD behavior for this policy is to allow reading the LOCATION property from build-targets. The NEW behavior for this policy is to not to allow reading the LOCATION property from build-targets. -This policy was introduced in CMake version 2.8.13. CMake version +This policy was introduced in CMake version 3.0.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. diff --git a/Help/variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION.rst b/Help/variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION.rst new file mode 100644 index 0000000..7e9d317 --- /dev/null +++ b/Help/variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION.rst @@ -0,0 +1,7 @@ +CMAKE_VS_INTEL_Fortran_PROJECT_VERSION +-------------------------------------- + +When generating for Visual Studio 7 or greater with the Intel Fortran +plugin installed, this specifies the .vfproj project file format +version. This is intended for internal use by CMake and should not be +used by project code. diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 6dde1c3..871cccd 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -19,6 +19,12 @@ /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) # endif +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif #elif defined(__PATHCC__) # define COMPILER_ID "PathScale" diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 3a60922..f32fee0 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -24,6 +24,12 @@ /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) # endif +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif #elif defined(__PATHCC__) # define COMPILER_ID "PathScale" diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index de4a882..e591f2c 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -114,7 +114,11 @@ Id flags: ${testflags} set(id_platform ${CMAKE_VS_PLATFORM_NAME}) set(id_lang "${lang}") set(id_cl cl.exe) - if(NOT "${vs_version}" VERSION_LESS 10) + if(lang STREQUAL Fortran) + set(v Intel) + set(ext vfproj) + set(id_cl ifort.exe) + elseif(NOT "${vs_version}" VERSION_LESS 10) set(v 10) set(ext vcxproj) elseif(NOT "${vs_version}" VERSION_LESS 7) @@ -130,6 +134,9 @@ Id flags: ${testflags} endif() if(CMAKE_VS_PLATFORM_TOOLSET) set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>") + if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel") + set(id_cl icl.exe) + endif() else() set(id_toolset "") endif() @@ -245,7 +252,10 @@ Id flags: ${testflags} endif() # Check the result of compilation. - if(CMAKE_${lang}_COMPILER_ID_RESULT) + if(CMAKE_${lang}_COMPILER_ID_RESULT + # Intel Fortran warns and ignores preprocessor lines without /fpp + OR CMAKE_${lang}_COMPILER_ID_OUTPUT MATCHES "Bad # preprocessor line" + ) # Compilation failed. set(MSG "Compiling the ${lang} compiler identification source file \"${src}\" failed. diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 4d3fb90..13cfb00 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -26,10 +26,6 @@ if(NOT CMAKE_Fortran_COMPILER_NAMES) endif() if(${CMAKE_GENERATOR} MATCHES "Visual Studio") - set(CMAKE_Fortran_COMPILER_ID_RUN 1) - set(CMAKE_Fortran_PLATFORM_ID "Windows") - set(CMAKE_Fortran_COMPILER_ID "Intel") - set(CMAKE_Fortran_COMPILER "${CMAKE_GENERATOR_FC}") elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") set(CMAKE_Fortran_COMPILER_XCODE_TYPE sourcecode.fortran.f90) else() diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index b4e2ae5..315d57e 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -32,6 +32,7 @@ # if it's the MS C/CXX compiler, search for link if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC" + OR "${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "MSVC" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio") diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index d193881..e4c7618 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -2,6 +2,8 @@ set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@") set(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@") set(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@") set(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@") +set(CMAKE_Fortran_SIMULATE_ID "@CMAKE_Fortran_SIMULATE_ID@") +set(CMAKE_Fortran_SIMULATE_VERSION "@CMAKE_Fortran_SIMULATE_VERSION@") @SET_MSVC_Fortran_ARCHITECTURE_ID@ set(CMAKE_AR "@CMAKE_AR@") set(CMAKE_RANLIB "@CMAKE_RANLIB@") diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index f84852a..5349505 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -4,6 +4,24 @@ #endif #if defined(__INTEL_COMPILER) || defined(__ICC) PRINT *, 'INFO:compiler[Intel]' +# if defined(_MSC_VER) + PRINT *, 'INFO:simulate[MSVC]' +# if _MSC_VER >= 1800 + PRINT *, 'INFO:simulate_version[018.00]' +# elif _MSC_VER >= 1700 + PRINT *, 'INFO:simulate_version[017.00]' +# elif _MSC_VER >= 1600 + PRINT *, 'INFO:simulate_version[016.00]' +# elif _MSC_VER >= 1500 + PRINT *, 'INFO:simulate_version[015.00]' +# elif _MSC_VER >= 1400 + PRINT *, 'INFO:simulate_version[014.00]' +# elif _MSC_VER >= 1310 + PRINT *, 'INFO:simulate_version[013.01]' +# else + PRINT *, 'INFO:simulate_version[013.00]' +# endif +# endif #elif defined(__SUNPRO_F90) || defined(__SUNPRO_F95) PRINT *, 'INFO:compiler[SunPro]' #elif defined(_CRAYFTN) diff --git a/Modules/CompilerId/VS-Intel.vfproj.in b/Modules/CompilerId/VS-Intel.vfproj.in new file mode 100644 index 0000000..044dd20 --- /dev/null +++ b/Modules/CompilerId/VS-Intel.vfproj.in @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<VisualStudioProject + ProjectCreator="Intel Fortran" + Keyword="Console Application" + Version="@CMAKE_VS_INTEL_Fortran_PROJECT_VERSION@" + ProjectIdGuid="{AB67BAB7-D7AE-4E97-B492-FE5420447509}" + > + <Platforms> + <Platform Name="@id_platform@"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|@id_platform@" + OutputDirectory="." + IntermediateDirectory="$(ConfigurationName)" + > + <Tool + Name="VFFortranCompilerTool" + DebugInformationFormat="debugEnabled" + Optimization="optimizeDisabled" + Preprocess="preprocessYes" + RuntimeLibrary="rtMultiThreadedDebugDLL" + /> + <Tool + Name="VFLinkerTool" + LinkIncremental="linkIncrementalNo" + GenerateDebugInformation="true" + SubSystem="subSystemConsole" + /> + <Tool + Name="VFPostBuildEventTool" + CommandLine="for %%i in (@id_cl@) do @echo CMAKE_@id_lang@_COMPILER=%%~$PATH:i" + /> + </Configuration> + </Configurations> + <Files> + <Filter Name="Source Files" Filter="F"> + <File RelativePath="@id_src@"/> + </Filter> + </Files> + <Globals/> +</VisualStudioProject> diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake index ec5f0ae..84cd303 100644 --- a/Modules/Platform/Windows-Intel-CXX.cmake +++ b/Modules/Platform/Windows-Intel-CXX.cmake @@ -1,4 +1,3 @@ include(Platform/Windows-Intel) set(_COMPILE_CXX " /TP") -set(_FLAGS_CXX " /EHsc /GR") __windows_compiler_intel(CXX) diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index 69a7f2f..34e6b37 100644 --- a/Modules/Platform/Windows-Intel.cmake +++ b/Modules/Platform/Windows-Intel.cmake @@ -18,92 +18,11 @@ if(__WINDOWS_INTEL) endif() set(__WINDOWS_INTEL 1) -# make sure to enable languages after setting configuration types -enable_language(RC) -set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") - -set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") -set(CMAKE_LINK_LIBRARY_FLAG "") -set(WIN32 1) -if(CMAKE_VERBOSE_MAKEFILE) - set(CMAKE_CL_NOLOGO) -else() - set(CMAKE_CL_NOLOGO "/nologo") -endif() -set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") -set(CMAKE_CREATE_WIN32_EXE /subsystem:windows) -set(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) - -# default to Debug builds -#set(CMAKE_BUILD_TYPE_INIT Debug) -set(CMAKE_BUILD_TYPE_INIT Release) - -set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") -set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") - -# executable linker flags -set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") -if(MSVC_C_ARCHITECTURE_ID) - set(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}") -elseif(MSVC_CXX_ARCHITECTURE_ID) - set(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}") -elseif(MSVC_Fortran_ARCHITECTURE_ID) - set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") -endif() -set (CMAKE_EXE_LINKER_FLAGS_INIT "/INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}") -set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") -set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") - -set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) -set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) -set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) -set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) - -include("${CMAKE_PLATFORM_INFO_DIR}/CMakeIntelInformation.cmake" OPTIONAL) - -if(NOT _INTEL_XILINK_TEST_RUN) - execute_process(COMMAND xilink /? - ERROR_VARIABLE _XILINK_ERR - OUTPUT_VARIABLE _XILINK_HELP) - if(_XILINK_HELP MATCHES MANIFEST) - set(_INTEL_COMPILER_SUPPORTS_MANIFEST 1) - endif() - if(NOT EXISTS "${CMAKE_PLATFORM_INFO_DIR}/CMakeIntelInformation.cmake") - file(WRITE ${CMAKE_PLATFORM_INFO_DIR}/CMakeIntelInformation.cmake - " -set(_INTEL_XILINK_TEST_RUN 1) -set(_INTEL_COMPILER_SUPPORTS_MANIFEST ${_INTEL_COMPILER_SUPPORTS_MANIFEST}) -") - endif() -endif() - +include(Platform/Windows-MSVC) macro(__windows_compiler_intel lang) - set(CMAKE_${lang}_COMPILE_OBJECT - "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo<OBJECT> /Fd<OBJECT_DIR>/ <DEFINES> <FLAGS> -c <SOURCE>${CMAKE_END_TEMP_FILE}") - set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE - "<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <FLAGS> -E <SOURCE>${CMAKE_END_TEMP_FILE}") - set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) - set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") - set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - "xilink ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") - set(CMAKE_${lang}_CREATE_SHARED_MODULE "${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") - set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link") - set(CMAKE_${lang}_LINK_EXECUTABLE - "<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> <OBJECTS> /link /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") - set(CMAKE_${lang}_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}") - set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Od /RTC1") - set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/DNDEBUG /MD /O1") - set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/DNDEBUG /MD /O2") - set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/DNDEBUG /MD /Zi /O2") - - if(_INTEL_COMPILER_SUPPORTS_MANIFEST) - set(CMAKE_${lang}_LINK_EXECUTABLE - "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_${lang}_LINK_EXECUTABLE}") - set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") - set(CMAKE_${lang}_CREATE_SHARED_MODULE - "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_MODULE}") - endif() + __windows_compiler_msvc(${lang}) + string(REPLACE "<CMAKE_LINKER> /lib" "lib" CMAKE_${lang}_CREATE_STATIC_LIBRARY "${CMAKE_${lang}_CREATE_STATIC_LIBRARY}") + foreach(rule CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE) + string(REPLACE "<CMAKE_LINKER>" "xilink" CMAKE_${lang}_${rule} "${CMAKE_${lang}_${rule}}") + endforeach() endmacro() diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index a2cfe33..8f0add7 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -69,6 +69,8 @@ if(NOT MSVC_VERSION) set(_compiler_version ${CMAKE_C_SIMULATE_VERSION}) elseif(CMAKE_CXX_SIMULATE_VERSION) set(_compiler_version ${CMAKE_CXX_SIMULATE_VERSION}) + elseif(CMAKE_Fortran_SIMULATE_VERSION) + set(_compiler_version ${CMAKE_Fortran_SIMULATE_VERSION}) elseif(CMAKE_C_COMPILER_VERSION) set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) else() @@ -182,12 +184,15 @@ set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") # executable linker flags set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") # set the machine type -set(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID}) -if(NOT _MACHINE_ARCH_FLAG) - set(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID}) +if(MSVC_C_ARCHITECTURE_ID) + set(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}") +elseif(MSVC_CXX_ARCHITECTURE_ID) + set(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}") +elseif(MSVC_Fortran_ARCHITECTURE_ID) + set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") endif() -set (CMAKE_EXE_LINKER_FLAGS_INIT - "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:${_MACHINE_ARCH_FLAG}") +set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} ${_MACHINE_ARCH_FLAG}") +unset(_MACHINE_ARCH_FLAG) # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype # on versions that support it diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6d9dbd1..b5d8520 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 12) -set(CMake_VERSION_TWEAK 20131017) +set(CMake_VERSION_TWEAK 20131018) #set(CMake_VERSION_RC 1) diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 0b9796d..d476c24 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -21,6 +21,7 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( const char* platformName) { this->FindMakeProgramFile = "CMakeVS7FindMake.cmake"; + this->IntelProjectVersion = 0; if (!platformName) { @@ -29,6 +30,45 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( this->PlatformName = platformName; } +cmGlobalVisualStudio7Generator::~cmGlobalVisualStudio7Generator() +{ + free(this->IntelProjectVersion); +} + +// Package GUID of Intel Visual Fortran plugin to VS IDE +#define CM_INTEL_PLUGIN_GUID "{B68A201D-CB9B-47AF-A52F-7EEC72E217E4}" + +const char* cmGlobalVisualStudio7Generator::GetIntelProjectVersion() +{ + if(!this->IntelProjectVersion) + { + // Compute the version of the Intel plugin to the VS IDE. + // If the key does not exist then use a default guess. + std::string intelVersion; + std::string vskey = this->GetRegistryBase(); + vskey += "\\Packages\\" CM_INTEL_PLUGIN_GUID ";ProductVersion"; + cmSystemTools::ReadRegistryValue(vskey.c_str(), intelVersion, + cmSystemTools::KeyWOW64_32); + unsigned int intelVersionNumber = ~0u; + sscanf(intelVersion.c_str(), "%u", &intelVersionNumber); + if(intelVersionNumber >= 11) + { + // Default to latest known project file version. + intelVersion = "11.0"; + } + else if(intelVersionNumber == 10) + { + // Version 10.x actually uses 9.10 in project files! + intelVersion = "9.10"; + } + else + { + // Version <= 9: use ProductVersion from registry. + } + this->IntelProjectVersion = strdup(intelVersion.c_str()); + } + return this->IntelProjectVersion; +} void cmGlobalVisualStudio7Generator ::EnableLanguage(std::vector<std::string>const & lang, @@ -36,7 +76,6 @@ void cmGlobalVisualStudio7Generator { mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); - mf->AddDefinition("CMAKE_GENERATOR_FC", "ifort"); this->AddPlatformDefinitions(mf); if(!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) { @@ -156,6 +195,8 @@ void cmGlobalVisualStudio7Generator::AddPlatformDefinitions(cmMakefile* mf) { cmGlobalVisualStudioGenerator::AddPlatformDefinitions(mf); mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName()); + mf->AddDefinition("CMAKE_VS_INTEL_Fortran_PROJECT_VERSION", + this->GetIntelProjectVersion()); } void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf) diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 4d22cff..66dc443 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -27,6 +27,8 @@ class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator { public: cmGlobalVisualStudio7Generator(const char* platformName = NULL); + ~cmGlobalVisualStudio7Generator(); + static cmGlobalGeneratorFactory* NewFactory() { return new cmGlobalGeneratorSimpleFactory <cmGlobalVisualStudio7Generator>(); } @@ -101,6 +103,8 @@ public: LinkLibraryDependencies and link to .sln dependencies. */ virtual bool NeedLinkLibraryDependencies(cmTarget&) { return false; } + const char* GetIntelProjectVersion(); + protected: virtual const char* GetIDEVersion() { return "7.0"; } @@ -159,6 +163,9 @@ protected: // There is one SLN file per project. std::string CurrentProject; std::string PlatformName; + +private: + char* IntelProjectVersion; }; #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK" diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 64de448..f21abc3 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -27,9 +27,6 @@ #include <ctype.h> // for isspace -// Package GUID of Intel Visual Fortran plugin to VS IDE -#define CM_INTEL_PLUGIN_GUID "{B68A201D-CB9B-47AF-A52F-7EEC72E217E4}" - static bool cmLVS6G_IsFAT(const char* dir); class cmLocalVisualStudio7GeneratorInternals @@ -1961,35 +1958,10 @@ cmLocalVisualStudio7Generator cmGlobalVisualStudio7Generator* gg = static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); - - // Compute the version of the Intel plugin to the VS IDE. - // If the key does not exist then use a default guess. - std::string intelVersion; - std::string vskey = gg->GetRegistryBase(); - vskey += "\\Packages\\" CM_INTEL_PLUGIN_GUID ";ProductVersion"; - cmSystemTools::ReadRegistryValue(vskey.c_str(), intelVersion, - cmSystemTools::KeyWOW64_32); - unsigned int intelVersionNumber = ~0u; - sscanf(intelVersion.c_str(), "%u", &intelVersionNumber); - if(intelVersionNumber >= 11) - { - // Default to latest known project file version. - intelVersion = "11.0"; - } - else if(intelVersionNumber == 10) - { - // Version 10.x actually uses 9.10 in project files! - intelVersion = "9.10"; - } - else - { - // Version <= 9: use ProductVersion from registry. - } - fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n" << "<VisualStudioProject\n" << "\tProjectCreator=\"Intel Fortran\"\n" - << "\tVersion=\"" << intelVersion << "\"\n"; + << "\tVersion=\"" << gg->GetIntelProjectVersion() << "\"\n"; const char* keyword = target.GetProperty("VS_KEYWORD"); if(!keyword) { diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 6ede28b..2ecdb42 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -19,14 +19,13 @@ public: cmPolicy(cmPolicies::PolicyID iD, const char *idString, const char *shortDescription, - const char *longDescription, unsigned int majorVersionIntroduced, unsigned int minorVersionIntroduced, unsigned int patchVersionIntroduced, unsigned int tweakVersionIntroduced, cmPolicies::PolicyStatus status) { - if (!idString || !shortDescription || ! longDescription) + if (!idString || !shortDescription) { cmSystemTools::Error("Attempt to define a policy without " "all parameters being specified!"); @@ -35,7 +34,6 @@ public: this->ID = iD; this->IDString = idString; this->ShortDescription = shortDescription; - this->LongDescription = longDescription; this->MajorVersionIntroduced = majorVersionIntroduced; this->MinorVersionIntroduced = minorVersionIntroduced; this->PatchVersionIntroduced = patchVersionIntroduced; @@ -90,7 +88,6 @@ public: cmPolicies::PolicyID ID; std::string IDString; std::string ShortDescription; - std::string LongDescription; unsigned int MajorVersionIntroduced; unsigned int MinorVersionIntroduced; unsigned int PatchVersionIntroduced; @@ -104,561 +101,141 @@ cmPolicies::cmPolicies() this->DefinePolicy( CMP0000, "CMP0000", "A minimum required CMake version must be specified.", - "CMake requires that projects specify the version of CMake to which " - "they have been written. " - "This policy has been put in place so users trying to build the project " - "may be told when they need to update their CMake. " - "Specifying a version also helps the project build with CMake versions " - "newer than that specified. " - "Use the cmake_minimum_required command at the top of your main " - " CMakeLists.txt file:\n" - " cmake_minimum_required(VERSION <major>.<minor>)\n" - "where \"<major>.<minor>\" is the version of CMake you want to support " - "(such as \"2.6\"). " - "The command will ensure that at least the given version of CMake is " - "running and help newer versions be compatible with the project. " - "See documentation of cmake_minimum_required for details.\n" - "Note that the command invocation must appear in the CMakeLists.txt " - "file itself; a call in an included file is not sufficient. " - "However, the cmake_policy command may be called to set policy " - "CMP0000 to OLD or NEW behavior explicitly. " - "The OLD behavior is to silently ignore the missing invocation. " - "The NEW behavior is to issue an error instead of a warning. " - "An included file may set CMP0000 explicitly to affect how this " - "policy is enforced for the main CMakeLists.txt file.", 2,6,0,0, cmPolicies::WARN ); this->DefinePolicy( CMP0001, "CMP0001", "CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", - "The OLD behavior is to check CMAKE_BACKWARDS_COMPATIBILITY and present " - "it to the user. " - "The NEW behavior is to ignore CMAKE_BACKWARDS_COMPATIBILITY " - "completely.\n" - "In CMake 2.4 and below the variable CMAKE_BACKWARDS_COMPATIBILITY was " - "used to request compatibility with earlier versions of CMake. " - "In CMake 2.6 and above all compatibility issues are handled by policies " - "and the cmake_policy command. " - "However, CMake must still check CMAKE_BACKWARDS_COMPATIBILITY for " - "projects written for CMake 2.4 and below.", 2,6,0,0, cmPolicies::WARN ); this->DefinePolicy( CMP0002, "CMP0002", "Logical target names must be globally unique.", - "Targets names created with " - "add_executable, add_library, or add_custom_target " - "are logical build target names. " - "Logical target names must be globally unique because:\n" - " - Unique names may be referenced unambiguously both in CMake\n" - " code and on make tool command lines.\n" - " - Logical names are used by Xcode and VS IDE generators\n" - " to produce meaningful project names for the targets.\n" - "The logical name of executable and library targets does not " - "have to correspond to the physical file names built. " - "Consider using the OUTPUT_NAME target property to create two " - "targets with the same physical name while keeping logical " - "names distinct. " - "Custom targets must simply have globally unique names (unless one " - "uses the global property ALLOW_DUPLICATE_CUSTOM_TARGETS with a " - "Makefiles generator).", 2,6,0,0, cmPolicies::WARN ); this->DefinePolicy( CMP0003, "CMP0003", "Libraries linked via full path no longer produce linker search paths.", - "This policy affects how libraries whose full paths are NOT known " - "are found at link time, but was created due to a change in how CMake " - "deals with libraries whose full paths are known. " - "Consider the code\n" - " target_link_libraries(myexe /path/to/libA.so)\n" - "CMake 2.4 and below implemented linking to libraries whose full paths " - "are known by splitting them on the link line into separate components " - "consisting of the linker search path and the library name. " - "The example code might have produced something like\n" - " ... -L/path/to -lA ...\n" - "in order to link to library A. " - "An analysis was performed to order multiple link directories such that " - "the linker would find library A in the desired location, but there " - "are cases in which this does not work. " - "CMake versions 2.6 and above use the more reliable approach of passing " - "the full path to libraries directly to the linker in most cases. " - "The example code now produces something like\n" - " ... /path/to/libA.so ....\n" - "Unfortunately this change can break code like\n" - " target_link_libraries(myexe /path/to/libA.so B)\n" - "where \"B\" is meant to find \"/path/to/libB.so\". " - "This code is wrong because the user is asking the linker to find " - "library B but has not provided a linker search path (which may be " - "added with the link_directories command). " - "However, with the old linking implementation the code would work " - "accidentally because the linker search path added for library A " - "allowed library B to be found." - "\n" - "In order to support projects depending on linker search paths " - "added by linking to libraries with known full paths, the OLD " - "behavior for this policy will add the linker search paths even " - "though they are not needed for their own libraries. " - "When this policy is set to OLD, CMake will produce a link line such as\n" - " ... -L/path/to /path/to/libA.so -lB ...\n" - "which will allow library B to be found as it was previously. " - "When this policy is set to NEW, CMake will produce a link line such as\n" - " ... /path/to/libA.so -lB ...\n" - "which more accurately matches what the project specified." - "\n" - "The setting for this policy used when generating the link line is that " - "in effect when the target is created by an add_executable or " - "add_library command. For the example described above, the code\n" - " cmake_policy(SET CMP0003 OLD) # or cmake_policy(VERSION 2.4)\n" - " add_executable(myexe myexe.c)\n" - " target_link_libraries(myexe /path/to/libA.so B)\n" - "will work and suppress the warning for this policy. " - "It may also be updated to work with the corrected linking approach:\n" - " cmake_policy(SET CMP0003 NEW) # or cmake_policy(VERSION 2.6)\n" - " link_directories(/path/to) # needed to find library B\n" - " add_executable(myexe myexe.c)\n" - " target_link_libraries(myexe /path/to/libA.so B)\n" - "Even better, library B may be specified with a full path:\n" - " add_executable(myexe myexe.c)\n" - " target_link_libraries(myexe /path/to/libA.so /path/to/libB.so)\n" - "When all items on the link line have known paths CMake does not check " - "this policy so it has no effect.\n" - "Note that the warning for this policy will be issued for at most " - "one target. This avoids flooding users with messages for every " - "target when setting the policy once will probably fix all targets.", 2,6,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0004, "CMP0004", "Libraries linked may not have leading or trailing whitespace.", - "CMake versions 2.4 and below silently removed leading and trailing " - "whitespace from libraries linked with code like\n" - " target_link_libraries(myexe \" A \")\n" - "This could lead to subtle errors in user projects.\n" - "The OLD behavior for this policy is to silently remove leading and " - "trailing whitespace. " - "The NEW behavior for this policy is to diagnose the existence of " - "such whitespace as an error. " - "The setting for this policy used when checking the library names is " - "that in effect when the target is created by an add_executable or " - "add_library command.", 2,6,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0005, "CMP0005", "Preprocessor definition values are now escaped automatically.", - "This policy determines whether or not CMake should generate escaped " - "preprocessor definition values added via add_definitions. " - "CMake versions 2.4 and below assumed that only trivial values would " - "be given for macros in add_definitions calls. " - "It did not attempt to escape non-trivial values such as string " - "literals in generated build rules. " - "CMake versions 2.6 and above support escaping of most values, but " - "cannot assume the user has not added escapes already in an attempt to " - "work around limitations in earlier versions.\n" - "The OLD behavior for this policy is to place definition values given " - "to add_definitions directly in the generated build rules without " - "attempting to escape anything. " - "The NEW behavior for this policy is to generate correct escapes " - "for all native build tools automatically. " - "See documentation of the COMPILE_DEFINITIONS target property for " - "limitations of the escaping implementation.", 2,6,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0006, "CMP0006", "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", - "This policy determines whether the install(TARGETS) command must be " - "given a BUNDLE DESTINATION when asked to install a target with the " - "MACOSX_BUNDLE property set. " - "CMake 2.4 and below did not distinguish application bundles from " - "normal executables when installing targets. " - "CMake 2.6 provides a BUNDLE option to the install(TARGETS) command " - "that specifies rules specific to application bundles on the Mac. " - "Projects should use this option when installing a target with the " - "MACOSX_BUNDLE property set.\n" - "The OLD behavior for this policy is to fall back to the RUNTIME " - "DESTINATION if a BUNDLE DESTINATION is not given. " - "The NEW behavior for this policy is to produce an error if a bundle " - "target is installed without a BUNDLE DESTINATION.", 2,6,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0007, "CMP0007", "list command no longer ignores empty elements.", - "This policy determines whether the list command will " - "ignore empty elements in the list. " - "CMake 2.4 and below list commands ignored all empty elements" - " in the list. For example, a;b;;c would have length 3 and not 4. " - "The OLD behavior for this policy is to ignore empty list elements. " - "The NEW behavior for this policy is to correctly count empty " - "elements in a list. ", 2,6,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0008, "CMP0008", "Libraries linked by full-path must have a valid library file name.", - "In CMake 2.4 and below it is possible to write code like\n" - " target_link_libraries(myexe /full/path/to/somelib)\n" - "where \"somelib\" is supposed to be a valid library file name " - "such as \"libsomelib.a\" or \"somelib.lib\". " - "For Makefile generators this produces an error at build time " - "because the dependency on the full path cannot be found. " - "For VS IDE and Xcode generators this used to work by accident because " - "CMake would always split off the library directory and ask the " - "linker to search for the library by name (-lsomelib or somelib.lib). " - "Despite the failure with Makefiles, some projects have code like this " - "and build only with VS and/or Xcode. " - "This version of CMake prefers to pass the full path directly to the " - "native build tool, which will fail in this case because it does " - "not name a valid library file." - "\n" - "This policy determines what to do with full paths that do not appear " - "to name a valid library file. " - "The OLD behavior for this policy is to split the library name from the " - "path and ask the linker to search for it. " - "The NEW behavior for this policy is to trust the given path and " - "pass it directly to the native build tool unchanged.", 2,6,1,0, cmPolicies::WARN); this->DefinePolicy( CMP0009, "CMP0009", "FILE GLOB_RECURSE calls should not follow symlinks by default.", - "In CMake 2.6.1 and below, FILE GLOB_RECURSE calls would follow " - "through symlinks, sometimes coming up with unexpectedly large " - "result sets because of symlinks to top level directories that " - "contain hundreds of thousands of files." - "\n" - "This policy determines whether or not to follow symlinks " - "encountered during a FILE GLOB_RECURSE call. " - "The OLD behavior for this policy is to follow the symlinks. " - "The NEW behavior for this policy is not to follow the symlinks " - "by default, but only if FOLLOW_SYMLINKS is given as an additional " - "argument to the FILE command.", 2,6,2,0, cmPolicies::WARN); this->DefinePolicy( CMP0010, "CMP0010", "Bad variable reference syntax is an error.", - "In CMake 2.6.2 and below, incorrect variable reference syntax such as " - "a missing close-brace (\"${FOO\") was reported but did not stop " - "processing of CMake code. " - "This policy determines whether a bad variable reference is an error. " - "The OLD behavior for this policy is to warn about the error, leave " - "the string untouched, and continue. " - "The NEW behavior for this policy is to report an error.", 2,6,3,0, cmPolicies::WARN); this->DefinePolicy( CMP0011, "CMP0011", "Included scripts do automatic cmake_policy PUSH and POP.", - "In CMake 2.6.2 and below, CMake Policy settings in scripts loaded by " - "the include() and find_package() commands would affect the includer. " - "Explicit invocations of cmake_policy(PUSH) and cmake_policy(POP) were " - "required to isolate policy changes and protect the includer. " - "While some scripts intend to affect the policies of their includer, " - "most do not. " - "In CMake 2.6.3 and above, include() and find_package() by default PUSH " - "and POP an entry on the policy stack around an included script, " - "but provide a NO_POLICY_SCOPE option to disable it. " - "This policy determines whether or not to imply NO_POLICY_SCOPE for " - "compatibility. " - "The OLD behavior for this policy is to imply NO_POLICY_SCOPE for " - "include() and find_package() commands. " - "The NEW behavior for this policy is to allow the commands to do their " - "default cmake_policy PUSH and POP.", 2,6,3,0, cmPolicies::WARN); this->DefinePolicy( CMP0012, "CMP0012", "if() recognizes numbers and boolean constants.", - "In CMake versions 2.6.4 and lower the if() command implicitly " - "dereferenced arguments corresponding to variables, even those named " - "like numbers or boolean constants, except for 0 and 1. " - "Numbers and boolean constants such as true, false, yes, no, " - "on, off, y, n, notfound, ignore (all case insensitive) were recognized " - "in some cases but not all. " - "For example, the code \"if(TRUE)\" might have evaluated as false. " - "Numbers such as 2 were recognized only in " - "boolean expressions like \"if(NOT 2)\" (leading to false) " - "but not as a single-argument like \"if(2)\" (also leading to false). " - "Later versions of CMake prefer to treat numbers and boolean constants " - "literally, so they should not be used as variable names." - "\n" - "The OLD behavior for this policy is to implicitly dereference variables " - "named like numbers and boolean constants. " - "The NEW behavior for this policy is to recognize numbers and " - "boolean constants without dereferencing variables with such names.", 2,8,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0013, "CMP0013", "Duplicate binary directories are not allowed.", - "CMake 2.6.3 and below silently permitted add_subdirectory() calls " - "to create the same binary directory multiple times. " - "During build system generation files would be written and then " - "overwritten in the build tree and could lead to strange behavior. " - "CMake 2.6.4 and above explicitly detect duplicate binary directories. " - "CMake 2.6.4 always considers this case an error. " - "In CMake 2.8.0 and above this policy determines whether or not " - "the case is an error. " - "The OLD behavior for this policy is to allow duplicate binary " - "directories. " - "The NEW behavior for this policy is to disallow duplicate binary " - "directories with an error.", 2,8,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0014, "CMP0014", "Input directories must have CMakeLists.txt.", - "CMake versions before 2.8 silently ignored missing CMakeLists.txt " - "files in directories referenced by add_subdirectory() or subdirs(), " - "treating them as if present but empty. " - "In CMake 2.8.0 and above this policy determines whether or not " - "the case is an error. " - "The OLD behavior for this policy is to silently ignore the problem. " - "The NEW behavior for this policy is to report an error.", 2,8,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0015, "CMP0015", "link_directories() treats paths relative to the source dir.", - "In CMake 2.8.0 and lower the link_directories() command passed relative " - "paths unchanged to the linker. " - "In CMake 2.8.1 and above the link_directories() command prefers to " - "interpret relative paths with respect to CMAKE_CURRENT_SOURCE_DIR, " - "which is consistent with include_directories() and other commands. " - "The OLD behavior for this policy is to use relative paths verbatim in " - "the linker command. " - "The NEW behavior for this policy is to convert relative paths to " - "absolute paths by appending the relative path to " - "CMAKE_CURRENT_SOURCE_DIR.", 2,8,1,0, cmPolicies::WARN); this->DefinePolicy( CMP0016, "CMP0016", "target_link_libraries() reports error if its only argument " "is not a target.", - "In CMake 2.8.2 and lower the target_link_libraries() command silently " - "ignored if it was called with only one argument, and this argument " - "wasn't a valid target. " - "In CMake 2.8.3 and above it reports an error in this case.", 2,8,3,0, cmPolicies::WARN); this->DefinePolicy( CMP0017, "CMP0017", "Prefer files from the CMake module directory when including from there.", - "Starting with CMake 2.8.4, if a cmake-module shipped with CMake (i.e. " - "located in the CMake module directory) calls include() or " - "find_package(), the files located in the CMake module directory are " - "preferred over the files in CMAKE_MODULE_PATH. " - "This makes sure that the modules belonging to " - "CMake always get those files included which they expect, and against " - "which they were developed and tested. " - "In all other cases, the files found in " - "CMAKE_MODULE_PATH still take precedence over the ones in " - "the CMake module directory. " - "The OLD behaviour is to always prefer files from CMAKE_MODULE_PATH over " - "files from the CMake modules directory.", 2,8,4,0, cmPolicies::WARN); this->DefinePolicy( CMP0018, "CMP0018", "Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.", - "CMake 2.8.8 and lower compiled sources in SHARED and MODULE libraries " - "using the value of the undocumented CMAKE_SHARED_LIBRARY_<Lang>_FLAGS " - "platform variable. The variable contained platform-specific flags " - "needed to compile objects for shared libraries. Typically it included " - "a flag such as -fPIC for position independent code but also included " - "other flags needed on certain platforms. CMake 2.8.9 and higher " - "prefer instead to use the POSITION_INDEPENDENT_CODE target property to " - "determine what targets should be position independent, and new " - "undocumented platform variables to select flags while ignoring " - "CMAKE_SHARED_LIBRARY_<Lang>_FLAGS completely." - "\n" - "The default for either approach produces identical compilation flags, " - "but if a project modifies CMAKE_SHARED_LIBRARY_<Lang>_FLAGS from its " - "original value this policy determines which approach to use." - "\n" - "The OLD behavior for this policy is to ignore the " - "POSITION_INDEPENDENT_CODE property for all targets and use the modified " - "value of CMAKE_SHARED_LIBRARY_<Lang>_FLAGS for SHARED and MODULE " - "libraries." - "\n" - "The NEW behavior for this policy is to ignore " - "CMAKE_SHARED_LIBRARY_<Lang>_FLAGS whether it is modified or not and " - "honor the POSITION_INDEPENDENT_CODE target property.", 2,8,9,0, cmPolicies::WARN); this->DefinePolicy( CMP0019, "CMP0019", "Do not re-expand variables in include and link information.", - "CMake 2.8.10 and lower re-evaluated values given to the " - "include_directories, link_directories, and link_libraries " - "commands to expand any leftover variable references at the " - "end of the configuration step. " - "This was for strict compatibility with VERY early CMake versions " - "because all variable references are now normally evaluated during " - "CMake language processing. " - "CMake 2.8.11 and higher prefer to skip the extra evaluation." - "\n" - "The OLD behavior for this policy is to re-evaluate the values " - "for strict compatibility. " - "The NEW behavior for this policy is to leave the values untouched.", 2,8,11,0, cmPolicies::WARN); this->DefinePolicy( CMP0020, "CMP0020", "Automatically link Qt executables to qtmain target on Windows.", - "CMake 2.8.10 and lower required users of Qt to always specify a link " - "dependency to the qtmain.lib static library manually on Windows. CMake " - "2.8.11 gained the ability to evaluate generator expressions while " - "determining the link dependencies from IMPORTED targets. This allows " - "CMake itself to automatically link executables which link to Qt to the " - "qtmain.lib library when using IMPORTED Qt targets. For applications " - "already linking to qtmain.lib, this should have little impact. For " - "applications which supply their own alternative WinMain implementation " - "and for applications which use the QAxServer library, this automatic " - "linking will need to be disabled as per the documentation." - "\n" - "The OLD behavior for this policy is not to link executables to " - "qtmain.lib automatically when they link to the QtCore IMPORTED" - "target. " - "The NEW behavior for this policy is to link executables to " - "qtmain.lib automatically when they link to QtCore IMPORTED target.", 2,8,11,0, cmPolicies::WARN); this->DefinePolicy( CMP0021, "CMP0021", "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", - "CMake 2.8.10.2 and lower allowed the INCLUDE_DIRECTORIES target " - "property to contain relative paths. The base path for such relative " - "entries is not well defined. CMake 2.8.12 issues a FATAL_ERROR if the " - "INCLUDE_DIRECTORIES property contains a relative path." - "\n" - "The OLD behavior for this policy is not to warn about relative paths in " - "the INCLUDE_DIRECTORIES target property. " - "The NEW behavior for this policy is to issue a FATAL_ERROR if " - "INCLUDE_DIRECTORIES contains a relative path.", 2,8,12,0, cmPolicies::WARN); this->DefinePolicy( CMP0022, "CMP0022", "INTERFACE_LINK_LIBRARIES defines the link interface.", - "CMake 2.8.11 constructed the 'link interface' of a target from " - "properties matching (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?. " - "The modern way to specify config-sensitive content is to use generator " - "expressions and the IMPORTED_ prefix makes uniform processing of the " - "link interface with generator expressions impossible. The " - "INTERFACE_LINK_LIBRARIES target property was introduced as a " - "replacement in CMake 2.8.12. This new property is named consistently " - "with the INTERFACE_COMPILE_DEFINITIONS, INTERFACE_INCLUDE_DIRECTORIES " - "and INTERFACE_COMPILE_OPTIONS properties. For in-build targets, CMake " - "will use the INTERFACE_LINK_LIBRARIES property as the source of the " - "link interface only if policy CMP0022 is NEW. " - "When exporting a target which has this policy set to NEW, only the " - "INTERFACE_LINK_LIBRARIES property will be processed and generated for " - "the IMPORTED target by default. A new option to the install(EXPORT) " - "and export commands allows export of the old-style properties for " - "compatibility with downstream users of CMake versions older than " - "2.8.12. " - "The target_link_libraries command will no longer populate the " - "properties matching LINK_INTERFACE_LIBRARIES(_<CONFIG>)? if this policy " - "is NEW." - "\n" - "The OLD behavior for this policy is to ignore the " - "INTERFACE_LINK_LIBRARIES property for in-build targets. " - "The NEW behavior for this policy is to use the INTERFACE_LINK_LIBRARIES " - "property for in-build targets, and ignore the old properties matching " - "(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?.", 2,8,12,0, cmPolicies::WARN); this->DefinePolicy( CMP0023, "CMP0023", "Plain and keyword target_link_libraries signatures cannot be mixed.", - "CMake 2.8.12 introduced the target_link_libraries signature using " - "the PUBLIC, PRIVATE, and INTERFACE keywords to generalize the " - "LINK_PUBLIC and LINK_PRIVATE keywords introduced in CMake 2.8.7. " - "Use of signatures with any of these keywords sets the link interface " - "of a target explicitly, even if empty. " - "This produces confusing behavior when used in combination with the " - "historical behavior of the plain target_link_libraries signature. " - "For example, consider the code:\n" - " target_link_libraries(mylib A)\n" - " target_link_libraries(mylib PRIVATE B)\n" - "After the first line the link interface has not been set explicitly " - "so CMake would use the link implementation, A, as the link interface. " - "However, the second line sets the link interface to empty. " - "In order to avoid this subtle behavior CMake now prefers to disallow " - "mixing the plain and keyword signatures of target_link_libraries for " - "a single target." - "\n" - "The OLD behavior for this policy is to allow keyword and plain " - "target_link_libraries signatures to be mixed. " - "The NEW behavior for this policy is to not to allow mixing of the " - "keyword and plain signatures.", 2,8,12,0, cmPolicies::WARN); this->DefinePolicy( CMP0024, "CMP0024", "Disallow include export result.", - "CMake 2.8.12 and lower allowed use of the include() command with the " - "result of the export() command. This relies on the assumption that " - "the export() command has an immediate effect at configure-time during a " - "cmake run. Certain properties of targets are not fully determined " - "until later at generate-time, such as the link language and complete " - "list of link libraries. Future refactoring will change the effect of " - "the export() command to be executed at generate-time. Use ALIAS " - "targets instead in cases where the goal is to refer to targets by " - "another name" - "\n" - "The OLD behavior for this policy is to allow including the result " - "of an export() command. " - "The NEW behavior for this policy is to not to allow including the " - "result of an export() command.", - 2,8,13,0, cmPolicies::WARN); + 3,0,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0025, "CMP0025", "Compiler id for Apple Clang is now AppleClang.", - "CMake >= 2.8.13 recognize that Apple Clang is a different compiler " - "than upstream Clang and that they have different version numbers. " - "CMake now prefers to present this to projects by setting " - "CMAKE_<LANG>_COMPILER_ID to \"AppleClang\" instead of \"Clang\". " - "However, existing projects may assume the compiler id for Apple Clang " - "is just \"Clang\" as it was in CMake < 2.8.13. " - "Therefore this policy determines for Apple Clang which compiler id " - "to report in CMAKE_<LANG>_COMPILER_ID after <LANG> is enabled by " - "the project() or enable_language() command." - "\n" - "The OLD behavior for this policy is to use compiler id \"Clang\". " - "The NEW behavior for this policy is to use compiler id \"AppleClang\".", - 2,8,13,0, cmPolicies::WARN); + 3,0,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0026, "CMP0026", "Disallow use of the LOCATION target property.", - "CMake 2.8.12 and lower allowed reading the LOCATION target property to " - "determine the eventual location of build targets. This relies on the " - "assumption that all necessary information is available at " - "configure-time to determine the final location and filename of the " - "target. However, this property is not fully determined until later at " - "generate-time. At generate time, the $<TARGET_FILE> generator " - "expression can be used to determine the eventual LOCATION of a target " - "output." - "\n" - "Code which reads the LOCATION target property can be ported to use the " - "$<TARGET_FILE> generator expression together with the file(GENERATE) " - "subcommand to generate a file containing the target location." - "\n" - "The OLD behavior for this policy is to allow reading the LOCATION " - "property from build-targets. " - "The NEW behavior for this policy is to not to allow reading the " - "LOCATION property from build-targets.", - 2,8,13,0, cmPolicies::WARN); + 3,0,0,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() @@ -675,7 +252,6 @@ cmPolicies::~cmPolicies() void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, const char *idString, const char *shortDescription, - const char *longDescription, unsigned int majorVersionIntroduced, unsigned int minorVersionIntroduced, unsigned int patchVersionIntroduced, @@ -692,7 +268,6 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, this->Policies[iD] = new cmPolicy(iD, idString, shortDescription, - longDescription, majorVersionIntroduced, minorVersionIntroduced, patchVersionIntroduced, diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index a9d1b49..81a4d99 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -97,7 +97,6 @@ public: void DefinePolicy(cmPolicies::PolicyID id, const char *stringID, const char *shortDescription, - const char *longDescription, unsigned int majorVersionIntroduced, unsigned int minorVersionIntroduced, unsigned int patchVersionIntroduced, diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 22f6a03..0707c62 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -151,7 +151,8 @@ bool cmTargetLinkLibrariesCommand else if(args[i] == "LINK_PUBLIC") { if(i != 1 - && this->CurrentProcessingState != ProcessingPlainPrivateInterface) + && this->CurrentProcessingState != ProcessingPlainPrivateInterface + && this->CurrentProcessingState != ProcessingPlainPublicInterface) { this->Makefile->IssueMessage( cmake::FATAL_ERROR, @@ -181,7 +182,8 @@ bool cmTargetLinkLibrariesCommand else if(args[i] == "LINK_PRIVATE") { if(i != 1 - && this->CurrentProcessingState != ProcessingPlainPublicInterface) + && this->CurrentProcessingState != ProcessingPlainPublicInterface + && this->CurrentProcessingState != ProcessingPlainPrivateInterface) { this->Makefile->IssueMessage( cmake::FATAL_ERROR, diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 5b534f0..5113a75 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -84,6 +84,17 @@ static const char * cmDocumentationOptions[][2] = #endif +static int do_command(int ac, char** av) +{ + std::vector<std::string> args; + args.push_back(av[0]); + for(int i = 2; i < ac; ++i) + { + args.push_back(av[i]); + } + return cmcmd::ExecuteCMakeCommand(args); +} + int do_cmake(int ac, char** av); static int do_build(int ac, char** av); @@ -157,9 +168,16 @@ int main(int ac, char** av) { cmSystemTools::EnableMSVCDebugHook(); cmSystemTools::FindExecutableDirectory(av[0]); - if(ac > 1 && strcmp(av[1], "--build") == 0) + if(ac > 1) { - return do_build(ac, av); + if(strcmp(av[1], "--build") == 0) + { + return do_build(ac, av); + } + else if(strcmp(av[1], "-E") == 0) + { + return do_command(ac, av); + } } int ret = do_cmake(ac, av); #ifdef CMAKE_BUILD_WITH_CMAKE @@ -180,7 +198,7 @@ int do_cmake(int ac, char** av) #ifdef CMAKE_BUILD_WITH_CMAKE cmDocumentation doc; doc.addCMakeStandardDocSections(); - if(doc.CheckOptions(ac, av, "-E")) + if(doc.CheckOptions(ac, av)) { // Construct and print requested documentation. cmake hcm; @@ -220,7 +238,6 @@ int do_cmake(int ac, char** av) bool wiz = false; bool sysinfo = false; - bool command = false; bool list_cached = false; bool list_all_cached = false; bool list_help = false; @@ -229,43 +246,37 @@ int do_cmake(int ac, char** av) std::vector<std::string> args; for(int i =0; i < ac; ++i) { - if(!command && strcmp(av[i], "-i") == 0) + if(strcmp(av[i], "-i") == 0) { wiz = true; } - else if(!command && strcmp(av[i], "--system-information") == 0) + else if(strcmp(av[i], "--system-information") == 0) { sysinfo = true; } - // if command has already been set, then - // do not eat the -E - else if (!command && strcmp(av[i], "-E") == 0) - { - command = true; - } - else if (!command && strcmp(av[i], "-N") == 0) + else if (strcmp(av[i], "-N") == 0) { view_only = true; } - else if (!command && strcmp(av[i], "-L") == 0) + else if (strcmp(av[i], "-L") == 0) { list_cached = true; } - else if (!command && strcmp(av[i], "-LA") == 0) + else if (strcmp(av[i], "-LA") == 0) { list_all_cached = true; } - else if (!command && strcmp(av[i], "-LH") == 0) + else if (strcmp(av[i], "-LH") == 0) { list_cached = true; list_help = true; } - else if (!command && strcmp(av[i], "-LAH") == 0) + else if (strcmp(av[i], "-LAH") == 0) { list_all_cached = true; list_help = true; } - else if (!command && strncmp(av[i], "-P", strlen("-P")) == 0) + else if (strncmp(av[i], "-P", strlen("-P")) == 0) { if ( i == ac -1 ) { @@ -279,8 +290,8 @@ int do_cmake(int ac, char** av) args.push_back(av[i]); } } - else if (!command && strncmp(av[i], "--find-package", - strlen("--find-package")) == 0) + else if (strncmp(av[i], "--find-package", + strlen("--find-package")) == 0) { workingMode = cmake::FIND_PACKAGE_MODE; args.push_back(av[i]); @@ -290,11 +301,6 @@ int do_cmake(int ac, char** av) args.push_back(av[i]); } } - if(command) - { - int ret = cmcmd::ExecuteCMakeCommand(args); - return ret; - } if (wiz) { cmakewizard wizard; diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in index f4510bb..03916bf 100644 --- a/Templates/TestDriver.cxx.in +++ b/Templates/TestDriver.cxx.in @@ -137,6 +137,13 @@ int main(int ac, char *av[]) { int result; @CMAKE_TESTDRIVER_BEFORE_TESTMAIN@ + if (testToRun < 0 || testToRun >= NumTests) + { + printf( + "testToRun was modified by TestDriver code to an invalid value: %3d.\n", + testNum); + return -1; + } result = (*cmakeGeneratedFunctionMapEntries[testToRun].func)(ac, av); @CMAKE_TESTDRIVER_AFTER_TESTMAIN@ return result; diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt index 06019e6..e11f980 100644 --- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt @@ -32,7 +32,7 @@ generate_export_header(depA) add_library(depB SHARED depB.cpp) generate_export_header(depB) -target_link_libraries(depB LINK_PRIVATE depA) +target_link_libraries(depB LINK_PRIVATE depA LINK_PRIVATE depA) add_library(libgenex SHARED libgenex.cpp) generate_export_header(libgenex) @@ -44,11 +44,11 @@ set_property(TARGET depB APPEND PROPERTY add_library(depC SHARED depC.cpp) generate_export_header(depC) -target_link_libraries(depC LINK_PUBLIC depA) +target_link_libraries(depC LINK_PUBLIC depA LINK_PUBLIC depA) assert_property(depA LINK_INTERFACE_LIBRARIES "") assert_property(depB LINK_INTERFACE_LIBRARIES "") -assert_property(depC LINK_INTERFACE_LIBRARIES "depA") +assert_property(depC LINK_INTERFACE_LIBRARIES "depA;depA") add_executable(targetA targetA.cpp) |