Notes |
|
(0040364)
|
Brad King
|
2016-01-29 13:26
|
|
|
|
(0040365)
|
senz
|
2016-01-29 13:28
(edited on: 2016-01-29 13:34) |
|
First line is cmake_minimum_required(VERSION 3.4) - no effect
|
|
|
(0040366)
|
Brad King
|
2016-01-29 13:36
|
|
$ export PATH=/usr/local/opt/llvm/bin:$PATH
$ export CXX=/usr/local/opt/llvm/bin/clang++
$ export CC=/usr/local/opt/llvm/bin/clang
$ cmake --version
cmake version 3.4.1
$ cat ../CMakeLists.txt
cmake_minimum_required(VERSION 3.3)
project(Issue15943)
set(CMAKE_CXX_STANDARD 14)
add_executable(foo foo.cxx)
$ cmake ..
-- The C compiler identification is Clang 3.6.2
-- The CXX compiler identification is Clang 3.6.2
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang -- works
...
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++ -- works
...
$ make VERBOSE=1 | grep std=
/usr/local/opt/llvm/bin/clang++ ... -std=gnu++14 ... |
|
|
(0040371)
|
senz
|
2016-01-29 14:03
|
|
Found the difference.
In faulty file project() command was never called, but it was set with set( PROJECT foo )
If calling project() flags are fine on both clangs. That is a very strange behavior |
|
|
(0040372)
|
senz
|
2016-01-29 14:06
|
|
cmake_minimum_required(VERSION 3.4)
#project(Issue15943)
set (PROJECT Issue15943)
set(CMAKE_CXX_STANDARD 14)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(foo foo.cxx) |
|
|
(0040374)
|
Brad King
|
2016-01-29 14:11
|
|
The project() command is required and is inserted on line 0 if not present:
https://cmake.org/cmake/help/v3.4/command/project.html [^]
"The top-level CMakeLists.txt file for a project must contain a literal,
direct call to the project() command; loading one through the include()
command is not sufficient. If no such call exists CMake will implicitly
add one to the top that enables the default languages (C and CXX)."
The implied call was originally meant to make hello-world projects shorter (e.g. just add_executable). Since it is inserted on line 0 that is before the cmake_minimum_required(VERSION) call sets CMP0025 to NEW so the code mentioned in 0015943:0040364 triggers. The reason is that without CMP0025 we don't know whether the Clang version number corresponds to upstream or Apple's fork. |
|
|
(0040375)
|
senz
|
2016-01-29 14:16
|
|
Tricky, thanks. Mb emit warning about implicit insert? At least in verbose mode |
|
|
(0040380)
|
Stephen Kelly
|
2016-01-30 01:49
|
|
|
|
(0042928)
|
Kitware Robot
|
2016-06-10 14:29
|
|
Resolving issue as `moved`.
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
|