Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CMake
CMake
Commits
fd771df7
Commit
fd771df7
authored
Jun 27, 2017
by
Brad King
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-crash-on-non-enabled-language-features' into release-3.9
parents
1d861038
e03a1b3b
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
49 additions
and
14 deletions
+49
-14
Source/cmMakefile.cxx
Source/cmMakefile.cxx
+19
-2
Tests/RunCMake/target_compile_features/CMakeLists.txt
Tests/RunCMake/target_compile_features/CMakeLists.txt
+1
-1
Tests/RunCMake/target_compile_features/RunCMakeTest.cmake
Tests/RunCMake/target_compile_features/RunCMakeTest.cmake
+1
-0
Tests/RunCMake/target_compile_features/alias_target-stderr.txt
.../RunCMake/target_compile_features/alias_target-stderr.txt
+1
-1
Tests/RunCMake/target_compile_features/alias_target.cmake
Tests/RunCMake/target_compile_features/alias_target.cmake
+1
-0
Tests/RunCMake/target_compile_features/cxx_not_enabled-result.txt
...nCMake/target_compile_features/cxx_not_enabled-result.txt
+1
-0
Tests/RunCMake/target_compile_features/cxx_not_enabled-stderr.txt
...nCMake/target_compile_features/cxx_not_enabled-stderr.txt
+4
-0
Tests/RunCMake/target_compile_features/cxx_not_enabled.cmake
Tests/RunCMake/target_compile_features/cxx_not_enabled.cmake
+2
-0
Tests/RunCMake/target_compile_features/imported_target-stderr.txt
...nCMake/target_compile_features/imported_target-stderr.txt
+1
-1
Tests/RunCMake/target_compile_features/imported_target.cmake
Tests/RunCMake/target_compile_features/imported_target.cmake
+1
-0
Tests/RunCMake/target_compile_features/invalid_args-stderr.txt
.../RunCMake/target_compile_features/invalid_args-stderr.txt
+1
-1
Tests/RunCMake/target_compile_features/invalid_args.cmake
Tests/RunCMake/target_compile_features/invalid_args.cmake
+1
-0
Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt
...get_compile_features/invalid_args_on_interface-stderr.txt
+1
-1
Tests/RunCMake/target_compile_features/invalid_args_on_interface.cmake
...e/target_compile_features/invalid_args_on_interface.cmake
+1
-0
Tests/RunCMake/target_compile_features/no_matching_c_feature-stderr.txt
.../target_compile_features/no_matching_c_feature-stderr.txt
+1
-1
Tests/RunCMake/target_compile_features/no_matching_c_feature.cmake
...CMake/target_compile_features/no_matching_c_feature.cmake
+1
-0
Tests/RunCMake/target_compile_features/no_matching_cxx_feature-stderr.txt
...arget_compile_features/no_matching_cxx_feature-stderr.txt
+1
-1
Tests/RunCMake/target_compile_features/no_matching_cxx_feature.cmake
...ake/target_compile_features/no_matching_cxx_feature.cmake
+1
-0
Tests/RunCMake/target_compile_features/no_target-stderr.txt
Tests/RunCMake/target_compile_features/no_target-stderr.txt
+1
-1
Tests/RunCMake/target_compile_features/no_target.cmake
Tests/RunCMake/target_compile_features/no_target.cmake
+1
-0
Tests/RunCMake/target_compile_features/not_a_c_feature-stderr.txt
...nCMake/target_compile_features/not_a_c_feature-stderr.txt
+1
-1
Tests/RunCMake/target_compile_features/not_a_c_feature.cmake
Tests/RunCMake/target_compile_features/not_a_c_feature.cmake
+1
-0
Tests/RunCMake/target_compile_features/not_a_cxx_feature-stderr.txt
...Make/target_compile_features/not_a_cxx_feature-stderr.txt
+1
-1
Tests/RunCMake/target_compile_features/not_a_cxx_feature.cmake
.../RunCMake/target_compile_features/not_a_cxx_feature.cmake
+1
-0
Tests/RunCMake/target_compile_features/not_enough_args-stderr.txt
...nCMake/target_compile_features/not_enough_args-stderr.txt
+1
-1
Tests/RunCMake/target_compile_features/not_enough_args.cmake
Tests/RunCMake/target_compile_features/not_enough_args.cmake
+1
-0
Tests/RunCMake/target_compile_features/utility_target-stderr.txt
...unCMake/target_compile_features/utility_target-stderr.txt
+1
-1
No files found.
Source/cmMakefile.cxx
View file @
fd771df7
...
...
@@ -4190,6 +4190,23 @@ bool cmMakefile::CompileFeatureKnown(cmTarget const* target,
const
char
*
cmMakefile
::
CompileFeaturesAvailable
(
const
std
::
string
&
lang
,
std
::
string
*
error
)
const
{
if
(
!
this
->
GlobalGenerator
->
GetLanguageEnabled
(
lang
))
{
std
::
ostringstream
e
;
if
(
error
)
{
e
<<
"cannot"
;
}
else
{
e
<<
"Cannot"
;
}
e
<<
" use features from non-enabled language "
<<
lang
;
if
(
error
)
{
*
error
=
e
.
str
();
}
else
{
this
->
GetCMakeInstance
()
->
IssueMessage
(
cmake
::
FATAL_ERROR
,
e
.
str
(),
this
->
Backtrace
);
}
return
CM_NULLPTR
;
}
const
char
*
featuresKnown
=
this
->
GetDefinition
(
"CMAKE_"
+
lang
+
"_COMPILE_FEATURES"
);
...
...
@@ -4201,9 +4218,9 @@ const char* cmMakefile::CompileFeaturesAvailable(const std::string& lang,
e
<<
"No"
;
}
e
<<
" known features for "
<<
lang
<<
" compiler
\n\"
"
<<
this
->
GetDefinition
(
"CMAKE_"
+
lang
+
"_COMPILER_ID"
)
<<
this
->
Get
Safe
Definition
(
"CMAKE_"
+
lang
+
"_COMPILER_ID"
)
<<
"
\"\n
version "
<<
this
->
GetDefinition
(
"CMAKE_"
+
lang
+
"_COMPILER_VERSION"
)
<<
"."
;
<<
this
->
Get
Safe
Definition
(
"CMAKE_"
+
lang
+
"_COMPILER_VERSION"
)
<<
"."
;
if
(
error
)
{
*
error
=
e
.
str
();
}
else
{
...
...
Tests/RunCMake/target_compile_features/CMakeLists.txt
View file @
fd771df7
cmake_minimum_required
(
VERSION 3.0
)
project
(
${
RunCMake_TEST
}
CXX
)
project
(
${
RunCMake_TEST
}
NONE
)
include
(
${
RunCMake_TEST
}
.cmake
)
Tests/RunCMake/target_compile_features/RunCMakeTest.cmake
View file @
fd771df7
...
...
@@ -11,3 +11,4 @@ run_cmake(not_a_cxx_feature)
run_cmake
(
no_matching_cxx_feature
)
run_cmake
(
not_a_c_feature
)
run_cmake
(
no_matching_c_feature
)
run_cmake
(
cxx_not_enabled
)
Tests/RunCMake/target_compile_features/alias_target-stderr.txt
View file @
fd771df7
CMake Error at alias_target.cmake:
4
\(target_compile_features\):
CMake Error at alias_target.cmake:
[0-9]+
\(target_compile_features\):
target_compile_features can not be used on an ALIAS target.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
Tests/RunCMake/target_compile_features/alias_target.cmake
View file @
fd771df7
enable_language
(
CXX
)
add_executable
(
main empty.cpp
)
add_executable
(
Alias::Main ALIAS main
)
...
...
Tests/RunCMake/target_compile_features/cxx_not_enabled-result.txt
0 → 100644
View file @
fd771df7
1
Tests/RunCMake/target_compile_features/cxx_not_enabled-stderr.txt
0 → 100644
View file @
fd771df7
^CMake Error at cxx_not_enabled.cmake:[0-9]+ \(target_compile_features\):
target_compile_features cannot use features from non-enabled language CXX
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
Tests/RunCMake/target_compile_features/cxx_not_enabled.cmake
0 → 100644
View file @
fd771df7
add_executable
(
main empty.c
)
target_compile_features
(
main PRIVATE cxx_decltype
)
Tests/RunCMake/target_compile_features/imported_target-stderr.txt
View file @
fd771df7
CMake Error at imported_target.cmake:
3
\(target_compile_features\):
CMake Error at imported_target.cmake:
[0-9]+
\(target_compile_features\):
Cannot specify compile features for imported target "main".
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
Tests/RunCMake/target_compile_features/imported_target.cmake
View file @
fd771df7
enable_language
(
CXX
)
add_library
(
main INTERFACE IMPORTED
)
target_compile_features
(
main INTERFACE cxx_delegating_constructors
)
Tests/RunCMake/target_compile_features/invalid_args-stderr.txt
View file @
fd771df7
CMake Error at invalid_args.cmake:
3
\(target_compile_features\):
CMake Error at invalid_args.cmake:
[0-9]+
\(target_compile_features\):
target_compile_features called with invalid arguments
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
Tests/RunCMake/target_compile_features/invalid_args.cmake
View file @
fd771df7
enable_language
(
CXX
)
add_executable
(
main empty.cpp
)
target_compile_features
(
main INVALID cxx_delegating_constructors
)
Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt
View file @
fd771df7
CMake Error at invalid_args_on_interface.cmake:
3
\(target_compile_features\):
CMake Error at invalid_args_on_interface.cmake:
[0-9]+
\(target_compile_features\):
target_compile_features may only be set INTERFACE properties on INTERFACE
targets
Call Stack \(most recent call first\):
...
...
Tests/RunCMake/target_compile_features/invalid_args_on_interface.cmake
View file @
fd771df7
enable_language
(
CXX
)
add_library
(
main INTERFACE
)
target_compile_features
(
main PRIVATE cxx_delegating_constructors
)
Tests/RunCMake/target_compile_features/no_matching_c_feature-stderr.txt
View file @
fd771df7
CMake Error at no_matching_c_feature.cmake:[0-9]
[0-9]?
\((target_compile_features|message)\):
CMake Error at no_matching_c_feature.cmake:[0-9]
+
\((target_compile_features|message)\):
The compiler feature "gnu_c_dummy" is not known to C compiler
"GNU"
...
...
Tests/RunCMake/target_compile_features/no_matching_c_feature.cmake
View file @
fd771df7
enable_language
(
CXX
)
if
(
NOT
";
${
CMAKE_C_COMPILE_FEATURES
}
;"
MATCHES
";gnu_c_typeof;"
)
# Simulate passing the test.
...
...
Tests/RunCMake/target_compile_features/no_matching_cxx_feature-stderr.txt
View file @
fd771df7
CMake Error at no_matching_cxx_feature.cmake:[0-9]
[0-9]?
\((target_compile_features|message)\):
CMake Error at no_matching_cxx_feature.cmake:[0-9]
+
\((target_compile_features|message)\):
The compiler feature "[^"]+" is not known to CXX compiler
"[^"]*"
...
...
Tests/RunCMake/target_compile_features/no_matching_cxx_feature.cmake
View file @
fd771df7
enable_language
(
CXX
)
if
(
NOT
";
${
CMAKE_CXX_COMPILE_FEATURES
}
;"
MATCHES
";gnu_cxx_typeof;"
AND NOT
";
${
CMAKE_CXX_COMPILE_FEATURES
}
;"
MATCHES
";msvc_cxx_sealed;"
)
...
...
Tests/RunCMake/target_compile_features/no_target-stderr.txt
View file @
fd771df7
CMake Error at no_target.cmake:
2
\(target_compile_features\):
CMake Error at no_target.cmake:
[0-9]+
\(target_compile_features\):
Cannot specify compile features for target "main" which is not built by
this project.
Call Stack \(most recent call first\):
...
...
Tests/RunCMake/target_compile_features/no_target.cmake
View file @
fd771df7
enable_language
(
CXX
)
target_compile_features
(
main INTERFACE cxx_delegating_constructors
)
Tests/RunCMake/target_compile_features/not_a_c_feature-stderr.txt
View file @
fd771df7
CMake Error at not_a_c_feature.cmake:
3
\(target_compile_features\):
CMake Error at not_a_c_feature.cmake:
[0-9]+
\(target_compile_features\):
target_compile_features specified unknown feature "c_not_a_feature" for
target "main".
Call Stack \(most recent call first\):
...
...
Tests/RunCMake/target_compile_features/not_a_c_feature.cmake
View file @
fd771df7
enable_language
(
C
)
add_executable
(
main empty.c
)
target_compile_features
(
main
...
...
Tests/RunCMake/target_compile_features/not_a_cxx_feature-stderr.txt
View file @
fd771df7
CMake Error at not_a_cxx_feature.cmake:
3
\(target_compile_features\):
CMake Error at not_a_cxx_feature.cmake:
[0-9]+
\(target_compile_features\):
target_compile_features specified unknown feature "cxx_not_a_feature" for
target "main".
Call Stack \(most recent call first\):
...
...
Tests/RunCMake/target_compile_features/not_a_cxx_feature.cmake
View file @
fd771df7
enable_language
(
CXX
)
add_executable
(
main empty.cpp
)
target_compile_features
(
main
...
...
Tests/RunCMake/target_compile_features/not_enough_args-stderr.txt
View file @
fd771df7
CMake Error at not_enough_args.cmake:
3
\(target_compile_features\):
CMake Error at not_enough_args.cmake:
[0-9]+
\(target_compile_features\):
target_compile_features called with incorrect number of arguments
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
Tests/RunCMake/target_compile_features/not_enough_args.cmake
View file @
fd771df7
enable_language
(
CXX
)
add_executable
(
main empty.cpp
)
target_compile_features
(
main
)
Tests/RunCMake/target_compile_features/utility_target-stderr.txt
View file @
fd771df7
CMake Error at utility_target.cmake:
4
\(target_compile_features\):
CMake Error at utility_target.cmake:
[0-9]+
\(target_compile_features\):
target_compile_features called with non-compilable target type
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment