View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0015943 | CMake | CMake | public | 2016-01-29 12:24 | 2016-06-10 14:31 | ||||
Reporter | senz | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | high | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | MAC | OS | OSX | OS Version | 10.11.3 | ||||
Product Version | CMake 3.4.3 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0015943: CMAKE_CXX_STANDARD not working on non-apple clang++ | ||||||||
Description | cmake does not set standard related flags on non-apple clang++ ignoring CMAKE_CXX_STANDARD var or/and CXX_STANDARD propery. | ||||||||
Steps To Reproduce | # brew install llvm --with-clang --with-libcxx --with-rtti # 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 project with set (CMAKE_CXX_STANDARD 14) set (CMAKE_CXX_STANDARD_REQUIRED ON) # make VERBOSE=1 no -std=c++14 flag | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |||||||||||
|
Relationships |
Notes | |
(0040364) Brad King (manager) 2016-01-29 13:26 |
This may be due to the code here: https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Compiler/Clang-CXX.cmake;hb=v3.4.3#l8 [^] cmake_policy(GET CMP0025 appleClangPolicy) if(WIN32 OR (APPLE AND NOT appleClangPolicy STREQUAL NEW)) return() endif() Check that the top-level CMakeLists.txt file starts with cmake_minimum_required(VERSION 3.0) # or higher before the project() command. |
(0040365) senz (reporter) 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 (manager) 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 (reporter) 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 (reporter) 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 (manager) 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 (reporter) 2016-01-29 14:16 |
Tricky, thanks. Mb emit warning about implicit insert? At least in verbose mode |
(0040380) Stephen Kelly (developer) 2016-01-30 01:49 |
If cmake_minimum_required() is required before project(), then users can't have this bug. http://public.kitware.com/Bug/view.php?id=15544 [^] |
(0042928) Kitware Robot (administrator) 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. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2016-01-29 12:24 | senz | New Issue | |
2016-01-29 13:26 | Brad King | Note Added: 0040364 | |
2016-01-29 13:27 | Brad King | Relationship added | related to 0015897 |
2016-01-29 13:28 | senz | Note Added: 0040365 | |
2016-01-29 13:34 | senz | Note Edited: 0040365 | |
2016-01-29 13:36 | Brad King | Note Added: 0040366 | |
2016-01-29 14:03 | senz | Note Added: 0040371 | |
2016-01-29 14:06 | senz | Note Added: 0040372 | |
2016-01-29 14:11 | Brad King | Note Added: 0040374 | |
2016-01-29 14:16 | senz | Note Added: 0040375 | |
2016-01-30 01:49 | Stephen Kelly | Note Added: 0040380 | |
2016-02-01 08:46 | Brad King | Relationship added | related to 0015544 |
2016-06-10 14:29 | Kitware Robot | Note Added: 0042928 | |
2016-06-10 14:29 | Kitware Robot | Status | new => resolved |
2016-06-10 14:29 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:29 | Kitware Robot | Assigned To | => Kitware Robot |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |