summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/target_include_directories.rst4
-rw-r--r--Modules/CMakeFindBinUtils.cmake12
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake2
-rw-r--r--Modules/Compiler/Clang-C.cmake10
-rw-r--r--Modules/Compiler/Clang-CXX.cmake2
-rw-r--r--Modules/Compiler/Clang.cmake4
-rw-r--r--Modules/Compiler/GNU-C.cmake7
-rw-r--r--Modules/FindJava.cmake5
-rw-r--r--Modules/FindOpenMP.cmake10
-rw-r--r--Modules/Platform/Windows-Clang.cmake4
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx18
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx119
-rw-r--r--Source/cmGlobalVisualStudio11Generator.h11
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx111
-rw-r--r--Source/cmGlobalVisualStudio12Generator.h10
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx3
-rw-r--r--Tests/CMakeLists.txt4
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt80
-rw-r--r--Tests/CompileFeatures/default_dialect.c22
-rw-r--r--Tests/CompileFeatures/default_dialect.cpp25
-rw-r--r--Tests/CompileFeatures/main.c12
-rw-r--r--Utilities/Sphinx/cmake.py1
23 files changed, 379 insertions, 102 deletions
diff --git a/Help/command/target_include_directories.rst b/Help/command/target_include_directories.rst
index 581bace..fd433a8 100644
--- a/Help/command/target_include_directories.rst
+++ b/Help/command/target_include_directories.rst
@@ -9,8 +9,8 @@ Add include directories to a target.
<INTERFACE|PUBLIC|PRIVATE> [items1...]
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
-Specify include directories or targets to use when compiling a given
-target. The named ``<target>`` must have been created by a command such
+Specify include directories to use when compiling a given target.
+The named ``<target>`` must have been created by a command such
as :command:`add_executable` or :command:`add_library` and must not be an
:prop_tgt:`IMPORTED` target.
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index e0ba131..376a6dc 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -30,12 +30,12 @@
# License text for the above reference.)
# 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"
+if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC"
+ OR (CMAKE_GENERATOR MATCHES "Visual Studio"
AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android"))
find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
index 0372e18..c1acae6 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -1,6 +1,6 @@
include(Compiler/Clang)
__compiler_clang(CXX)
-if(NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
index 05d3c0b..d504d69 100644
--- a/Modules/Compiler/Clang-C.cmake
+++ b/Modules/Compiler/Clang-C.cmake
@@ -6,7 +6,7 @@ if(WIN32 OR (APPLE AND NOT appleClangPolicy STREQUAL NEW))
return()
endif()
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
+if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
@@ -17,14 +17,18 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
endif()
-set(CMAKE_C_STANDARD_DEFAULT 90)
+if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6)
+ set(CMAKE_C_STANDARD_DEFAULT 11)
+elseif(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
+ set(CMAKE_C_STANDARD_DEFAULT 99)
+endif()
macro(cmake_record_c_compile_features)
macro(_get_clang_features std_version list)
record_compiler_features(C "-std=${std_version}" ${list})
endmacro()
- if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
+ if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
_get_clang_features(c11 CMAKE_C11_COMPILE_FEATURES)
if (_result EQUAL 0)
_get_clang_features(c99 CMAKE_C99_COMPILE_FEATURES)
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 5dd7b4a..9ef1413 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -1,7 +1,7 @@
include(Compiler/Clang)
__compiler_clang(CXX)
-if(NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index eeba119..701089c 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -18,8 +18,8 @@ if(__COMPILER_CLANG)
endif()
set(__COMPILER_CLANG 1)
-if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC"
- OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
macro(__compiler_clang lang)
endmacro()
else()
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
index 35954be..24d439d 100644
--- a/Modules/Compiler/GNU-C.cmake
+++ b/Modules/Compiler/GNU-C.cmake
@@ -12,8 +12,11 @@ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
endif()
-# This may change in a future GNU version.
-set(CMAKE_C_STANDARD_DEFAULT 90)
+if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
+ set(CMAKE_C_STANDARD_DEFAULT 11)
+else(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
+ set(CMAKE_C_STANDARD_DEFAULT 90)
+endif()
macro(cmake_record_c_compile_features)
macro(_get_gcc_features std_version list)
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index 79be34e..bb73853 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -115,7 +115,10 @@ if(Java_JAVA_EXECUTABLE)
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if( res )
- if(${Java_FIND_REQUIRED})
+ if(var MATCHES "No Java runtime present, requesting install")
+ set_property(CACHE Java_JAVA_EXECUTABLE
+ PROPERTY VALUE "Java_JAVA_EXECUTABLE-NOTFOUND")
+ elseif(${Java_FIND_REQUIRED})
message( FATAL_ERROR "Error executing java -version" )
else()
message( STATUS "Warning, could not run java -version")
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 801b4f8..a102c66 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -111,11 +111,11 @@ int main() {
# same in Fortran
set(OpenMP_Fortran_TEST_SOURCE
"
-program test
-use omp_lib
-integer :: n
-n = omp_get_num_threads()
-end program test
+ program test
+ use omp_lib
+ integer :: n
+ n = omp_get_num_threads()
+ end program test
"
)
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index 4c936fe..da19a3d 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -18,8 +18,8 @@ if(__WINDOWS_CLANG)
endif()
set(__WINDOWS_CLANG 1)
-if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC"
- OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
include(Platform/Windows-MSVC)
macro(__windows_compiler_clang lang)
__windows_compiler_msvc(${lang})
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index d70d2af..499ac56 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -262,6 +262,24 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf)
}
//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset(
+ std::string& toolset) const
+{
+ toolset = "";
+ return false;
+}
+
+//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset(
+ std::string& toolset) const
+{
+ toolset = "";
+ return false;
+}
+
+//----------------------------------------------------------------------------
std::string cmGlobalVisualStudio10Generator::SelectWindowsCEToolset() const
{
if (this->SystemVersion == "8.0")
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 686dcdf..3b0a5cf 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -118,9 +118,10 @@ protected:
virtual bool InitializeWindowsCE(cmMakefile* mf);
virtual bool InitializeWindowsPhone(cmMakefile* mf);
virtual bool InitializeWindowsStore(cmMakefile* mf);
+
virtual std::string SelectWindowsCEToolset() const;
- virtual std::string SelectWindowsPhoneToolset() const { return ""; }
- virtual std::string SelectWindowsStoreToolset() const { return ""; }
+ virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
+ virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
virtual const char* GetIDEVersion() { return "10.0"; }
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 39bbdc0..2b69222 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -131,12 +131,20 @@ cmGlobalVisualStudio11Generator::MatchesGeneratorName(
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf)
{
- this->DefaultPlatformToolset = this->SelectWindowsPhoneToolset();
- if(this->DefaultPlatformToolset.empty())
+ if(!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset))
{
cmOStringStream e;
- e << this->GetName() << " supports Windows Phone '8.0', but not '"
- << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ if(this->DefaultPlatformToolset.empty())
+ {
+ e << this->GetName() << " supports Windows Phone '8.0', but not '"
+ << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ }
+ else
+ {
+ e << "A Windows Phone component with CMake requires both the Windows "
+ << "Desktop SDK as well as the Windows Phone '" << this->SystemVersion
+ << "' SDK. Please make sure that you have both installed";
+ }
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
@@ -146,12 +154,20 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf)
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf)
{
- this->DefaultPlatformToolset = this->SelectWindowsStoreToolset();
- if(this->DefaultPlatformToolset.empty())
+ if(!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset))
{
cmOStringStream e;
- e << this->GetName() << " supports Windows Store '8.0', but not '"
- << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ if(this->DefaultPlatformToolset.empty())
+ {
+ e << this->GetName() << " supports Windows Store '8.0', but not '"
+ << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ }
+ else
+ {
+ e << "A Windows Store component with CMake requires both the Windows "
+ << "Desktop SDK as well as the Windows Store '" << this->SystemVersion
+ << "' SDK. Please make sure that you have both installed";
+ }
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
@@ -159,23 +175,47 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf)
}
//----------------------------------------------------------------------------
-std::string cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset() const
+bool
+cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset(
+ std::string& toolset) const
{
if(this->SystemVersion == "8.0")
{
- return "v110_wp80";
+ if (this->IsWindowsPhoneToolsetInstalled() &&
+ this->IsWindowsDesktopToolsetInstalled())
+ {
+ toolset = "v110_wp80";
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
- return this->cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset();
+ return
+ this->cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset(toolset);
}
//----------------------------------------------------------------------------
-std::string cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset() const
+bool
+cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset(
+ std::string& toolset) const
{
if(this->SystemVersion == "8.0")
{
- return "v110";
+ if(this->IsWindowsStoreToolsetInstalled() &&
+ this->IsWindowsDesktopToolsetInstalled())
+ {
+ toolset = "v110";
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
- return this->cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset();
+ return
+ this->cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset(toolset);
}
//----------------------------------------------------------------------------
@@ -256,3 +296,54 @@ cmGlobalVisualStudio11Generator::NeedsDeploy(cmTarget::TargetType type) const
}
return cmGlobalVisualStudio10Generator::NeedsDeploy(type);
}
+
+//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio11Generator::IsWindowsDesktopToolsetInstalled() const
+{
+ const char desktop80Key[] =
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "VisualStudio\\11.0\\VC\\Libraries\\Extended";
+ const char VS2012DesktopExpressKey[] =
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "WDExpress\\11.0;InstallDir";
+
+ std::vector<std::string> subkeys;
+ std::string path;
+ return cmSystemTools::ReadRegistryValue(VS2012DesktopExpressKey,
+ path,
+ cmSystemTools::KeyWOW64_32) ||
+ cmSystemTools::GetRegistrySubKeys(desktop80Key,
+ subkeys,
+ cmSystemTools::KeyWOW64_32);
+}
+
+//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio11Generator::IsWindowsPhoneToolsetInstalled() const
+{
+ const char wp80Key[] =
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "Microsoft SDKs\\WindowsPhone\\v8.0\\"
+ "Install Path;Install Path";
+
+ std::string path;
+ cmSystemTools::ReadRegistryValue(wp80Key,
+ path,
+ cmSystemTools::KeyWOW64_32);
+ return !path.empty();
+}
+
+//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio11Generator::IsWindowsStoreToolsetInstalled() const
+{
+ const char win80Key[] =
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "VisualStudio\\11.0\\VC\\Libraries\\Core\\Arm";
+
+ std::vector<std::string> subkeys;
+ return cmSystemTools::GetRegistrySubKeys(win80Key,
+ subkeys,
+ cmSystemTools::KeyWOW64_32);
+}
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
index bbd935c..c79dc97 100644
--- a/Source/cmGlobalVisualStudio11Generator.h
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -36,8 +36,15 @@ public:
protected:
virtual bool InitializeWindowsPhone(cmMakefile* mf);
virtual bool InitializeWindowsStore(cmMakefile* mf);
- virtual std::string SelectWindowsPhoneToolset() const;
- virtual std::string SelectWindowsStoreToolset() const;
+ virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
+ virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
+
+ // These aren't virtual because we need to check if the selected version
+ // of the toolset is installed
+ bool IsWindowsDesktopToolsetInstalled() const;
+ bool IsWindowsPhoneToolsetInstalled() const;
+ bool IsWindowsStoreToolsetInstalled() const;
+
virtual const char* GetIDEVersion() { return "11.0"; }
bool UseFolderProperty();
static std::set<std::string> GetInstalledWindowsCESDKs();
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 29ecfe0..047f2ad 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -111,12 +111,20 @@ cmGlobalVisualStudio12Generator::MatchesGeneratorName(
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf)
{
- this->DefaultPlatformToolset = this->SelectWindowsPhoneToolset();
- if(this->DefaultPlatformToolset.empty())
+ if(!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset))
{
cmOStringStream e;
- e << this->GetName() << " supports Windows Phone '8.0' and '8.1', "
- "but not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ if(this->DefaultPlatformToolset.empty())
+ {
+ e << this->GetName() << " supports Windows Phone '8.0' and '8.1', but "
+ "not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ }
+ else
+ {
+ e << "A Windows Phone component with CMake requires both the Windows "
+ << "Desktop SDK as well as the Windows Phone '" << this->SystemVersion
+ << "' SDK. Please make sure that you have both installed";
+ }
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
@@ -126,12 +134,20 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf)
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf)
{
- this->DefaultPlatformToolset = this->SelectWindowsStoreToolset();
- if(this->DefaultPlatformToolset.empty())
+ if(!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset))
{
cmOStringStream e;
- e << this->GetName() << " supports Windows Store '8.0' and '8.1', "
- "but not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ if(this->DefaultPlatformToolset.empty())
+ {
+ e << this->GetName() << " supports Windows Store '8.0' and '8.1', but "
+ "not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ }
+ else
+ {
+ e << "A Windows Store component with CMake requires both the Windows "
+ << "Desktop SDK as well as the Windows Store '" << this->SystemVersion
+ << "' SDK. Please make sure that you have both installed";
+ }
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
@@ -139,23 +155,47 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf)
}
//----------------------------------------------------------------------------
-std::string cmGlobalVisualStudio12Generator::SelectWindowsPhoneToolset() const
+bool
+cmGlobalVisualStudio12Generator::SelectWindowsPhoneToolset(
+ std::string& toolset) const
{
if(this->SystemVersion == "8.1")
{
- return "v120_wp81";
+ if (this->IsWindowsPhoneToolsetInstalled() &&
+ this->IsWindowsDesktopToolsetInstalled())
+ {
+ toolset = "v120_wp81";
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
- return this->cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset();
+ return
+ this->cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset(toolset);
}
//----------------------------------------------------------------------------
-std::string cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset() const
+bool
+cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset(
+ std::string& toolset) const
{
if(this->SystemVersion == "8.1")
{
- return "v120";
+ if(this->IsWindowsStoreToolsetInstalled() &&
+ this->IsWindowsDesktopToolsetInstalled())
+ {
+ toolset = "v120";
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
- return this->cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset();
+ return
+ this->cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset(toolset);
}
//----------------------------------------------------------------------------
@@ -180,3 +220,46 @@ cmLocalGenerator *cmGlobalVisualStudio12Generator::CreateLocalGenerator()
lg->SetGlobalGenerator(this);
return lg;
}
+
+//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio12Generator::IsWindowsDesktopToolsetInstalled() const
+{
+ const char desktop81Key[] =
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "VisualStudio\\12.0\\VC\\LibraryDesktop";
+
+ std::vector<std::string> subkeys;
+ return cmSystemTools::GetRegistrySubKeys(desktop81Key,
+ subkeys,
+ cmSystemTools::KeyWOW64_32);
+}
+
+//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio12Generator::IsWindowsPhoneToolsetInstalled() const
+{
+ const char wp81Key[] =
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "Microsoft SDKs\\WindowsPhone\\v8.1\\Install Path;Install Path";
+
+ std::string path;
+ cmSystemTools::ReadRegistryValue(wp81Key,
+ path,
+ cmSystemTools::KeyWOW64_32);
+ return !path.empty();
+}
+
+//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio12Generator::IsWindowsStoreToolsetInstalled() const
+{
+ const char win81Key[] =
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "VisualStudio\\12.0\\VC\\Libraries\\Core\\Arm";
+
+ std::vector<std::string> subkeys;
+ return cmSystemTools::GetRegistrySubKeys(win81Key,
+ subkeys,
+ cmSystemTools::KeyWOW64_32);
+}
diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h
index ec85f10..a81516f 100644
--- a/Source/cmGlobalVisualStudio12Generator.h
+++ b/Source/cmGlobalVisualStudio12Generator.h
@@ -41,8 +41,14 @@ public:
protected:
virtual bool InitializeWindowsPhone(cmMakefile* mf);
virtual bool InitializeWindowsStore(cmMakefile* mf);
- virtual std::string SelectWindowsPhoneToolset() const;
- virtual std::string SelectWindowsStoreToolset() const;
+ virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
+ virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
+
+ // These aren't virtual because we need to check if the selected version
+ // of the toolset is installed
+ bool IsWindowsDesktopToolsetInstalled() const;
+ bool IsWindowsPhoneToolsetInstalled() const;
+ bool IsWindowsStoreToolsetInstalled() const;
virtual const char* GetIDEVersion() { return "12.0"; }
private:
class Factory;
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 8109b16..1ac13cf 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2036,7 +2036,8 @@ WriteMasmOptions(std::string const& configName,
void
cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
{
- if(this->Target->GetType() != cmTarget::STATIC_LIBRARY)
+ if(this->Target->GetType() != cmTarget::STATIC_LIBRARY &&
+ this->Target->GetType() != cmTarget::OBJECT_LIBRARY)
{
return;
}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 25cc846..a9cad14 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -292,11 +292,11 @@ if(BUILD_TESTING)
endif()
ADD_TEST_MACRO(SourcesProperty SourcesProperty)
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU
- AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
+ AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
set(runCxxDialectTest 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL Clang
- AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.9)
+ AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
if(NOT APPLE OR POLICY CMP0025)
set(runCxxDialectTest 1)
endif()
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index d02ddaf..ff5d745 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -77,36 +77,60 @@ foreach(lang CXX C)
endif()
endforeach()
-add_executable(CompileFeatures main.cpp)
-set_property(TARGET CompileFeatures
- PROPERTY COMPILE_FEATURES "cxx_auto_type"
-)
-set_property(TARGET CompileFeatures
- PROPERTY CXX_STANDARD_REQUIRED TRUE
-)
+if (CMAKE_C_COMPILE_FEATURES)
+ string(FIND "${CMAKE_C_FLAGS}" "-std=" std_flag_idx)
+ if (std_flag_idx EQUAL -1)
+ add_executable(default_dialect_C default_dialect.c)
+ target_compile_definitions(default_dialect_C PRIVATE
+ DEFAULT_C11=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},11>
+ DEFAULT_C99=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},99>
+ DEFAULT_C90=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},90>
+ )
+ endif()
+endif()
+
+if (CMAKE_CXX_COMPILE_FEATURES)
+ string(FIND "${CMAKE_CXX_FLAGS}" "-std=" std_flag_idx)
+ if (std_flag_idx EQUAL -1)
+ add_executable(default_dialect default_dialect.cpp)
+ target_compile_definitions(default_dialect PRIVATE
+ DEFAULT_CXX14=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},14>
+ DEFAULT_CXX11=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},11>
+ DEFAULT_CXX98=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},98>
+ )
+ endif()
-add_executable(GenexCompileFeatures main.cpp)
-set_property(TARGET GenexCompileFeatures
- PROPERTY COMPILE_FEATURES "$<1:cxx_auto_type>;$<0:not_a_feature>"
-)
+ add_executable(CompileFeatures main.cpp)
+ set_property(TARGET CompileFeatures
+ PROPERTY COMPILE_FEATURES "cxx_auto_type"
+ )
+ set_property(TARGET CompileFeatures
+ PROPERTY CXX_STANDARD_REQUIRED TRUE
+ )
+
+ add_executable(GenexCompileFeatures main.cpp)
+ set_property(TARGET GenexCompileFeatures
+ PROPERTY COMPILE_FEATURES "$<1:cxx_auto_type>;$<0:not_a_feature>"
+ )
-add_library(iface INTERFACE)
-set_property(TARGET iface
- PROPERTY INTERFACE_COMPILE_FEATURES "cxx_auto_type"
-)
-add_executable(IfaceCompileFeatures main.cpp)
-target_link_libraries(IfaceCompileFeatures iface)
+ add_library(iface INTERFACE)
+ set_property(TARGET iface
+ PROPERTY INTERFACE_COMPILE_FEATURES "cxx_auto_type"
+ )
+ add_executable(IfaceCompileFeatures main.cpp)
+ target_link_libraries(IfaceCompileFeatures iface)
-add_executable(CompileFeaturesGenex genex_test.cpp)
-set_property(TARGET CompileFeaturesGenex PROPERTY CXX_STANDARD 11)
-target_compile_definitions(CompileFeaturesGenex PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>)
+ add_executable(CompileFeaturesGenex genex_test.cpp)
+ set_property(TARGET CompileFeaturesGenex PROPERTY CXX_STANDARD 11)
+ target_compile_definitions(CompileFeaturesGenex PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>)
-add_executable(CompileFeaturesGenex2 genex_test.cpp)
-target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_constexpr)
-target_compile_definitions(CompileFeaturesGenex2 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>)
+ add_executable(CompileFeaturesGenex2 genex_test.cpp)
+ target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_constexpr)
+ target_compile_definitions(CompileFeaturesGenex2 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>)
-add_library(noexcept_iface INTERFACE)
-target_compile_features(noexcept_iface INTERFACE cxx_noexcept)
-add_executable(CompileFeaturesGenex3 genex_test.cpp)
-target_link_libraries(CompileFeaturesGenex3 PRIVATE noexcept_iface)
-target_compile_definitions(CompileFeaturesGenex3 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>)
+ add_library(noexcept_iface INTERFACE)
+ target_compile_features(noexcept_iface INTERFACE cxx_noexcept)
+ add_executable(CompileFeaturesGenex3 genex_test.cpp)
+ target_link_libraries(CompileFeaturesGenex3 PRIVATE noexcept_iface)
+ target_compile_definitions(CompileFeaturesGenex3 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>)
+endif()
diff --git a/Tests/CompileFeatures/default_dialect.c b/Tests/CompileFeatures/default_dialect.c
new file mode 100644
index 0000000..1b39dec
--- /dev/null
+++ b/Tests/CompileFeatures/default_dialect.c
@@ -0,0 +1,22 @@
+
+#if DEFAULT_C11
+# if __STDC_VERSION__ != 201112L
+# error Unexpected value for __STDC_VERSION__.
+# endif
+#elif DEFAULT_C99
+# if __STDC_VERSION__ != 199901L
+# error Unexpected value for __STDC_VERSION__.
+# endif
+#else
+# if !DEFAULT_C90
+# error Buildsystem error
+# endif
+# if defined(__STDC_VERSION__)
+# error Unexpected __STDC_VERSION__ definition
+# endif
+#endif
+
+int main()
+{
+ return 0;
+}
diff --git a/Tests/CompileFeatures/default_dialect.cpp b/Tests/CompileFeatures/default_dialect.cpp
new file mode 100644
index 0000000..8d97926
--- /dev/null
+++ b/Tests/CompileFeatures/default_dialect.cpp
@@ -0,0 +1,25 @@
+
+template<long l>
+struct Outputter;
+
+#if DEFAULT_CXX14
+# if __cplusplus != 201402L
+Outputter<__cplusplus> o;
+# endif
+#elif DEFAULT_CXX11
+# if __cplusplus != 201103L
+Outputter<__cplusplus> o;
+# endif
+#else
+# if !DEFAULT_CXX98
+# error Buildsystem error
+# endif
+# if __cplusplus != 199711L
+Outputter<__cplusplus> o;
+# endif
+#endif
+
+int main()
+{
+ return 0;
+}
diff --git a/Tests/CompileFeatures/main.c b/Tests/CompileFeatures/main.c
deleted file mode 100644
index 831c5eb2..0000000
--- a/Tests/CompileFeatures/main.c
+++ /dev/null
@@ -1,12 +0,0 @@
-
-int foo(int * restrict a, int * restrict b)
-{
- (void)a;
- (void)b;
- return 0;
-}
-
-int main()
-{
- return 0;
-}
diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py
index ec39596..e20679a 100644
--- a/Utilities/Sphinx/cmake.py
+++ b/Utilities/Sphinx/cmake.py
@@ -203,6 +203,7 @@ class CMakeTransform(Transform):
# Insert the object link target.
targetid = '%s:%s' % (objtype, title)
targetnode = nodes.target('', '', ids=[targetid])
+ self.document.note_explicit_target(targetnode)
self.document.insert(0, targetnode)
# Insert the object index entry.
indexnode = addnodes.index()