malaterre
(Mathieu Malaterre)
October 6, 2022, 5:04pm
1
I am observing a change in behavior in between cmake 3.16.3 and 3.24.2.
Basically the following is working as expected in cmake 3.16.3 :
cmake_minimum_required(VERSION 3.10)
project(p)
set(CMAKE_REQUIRED_FLAGS "-std=c++11")
check_cxx_source_compiles("${my_code}" MY_VAR)
However in cmake 3.24.1, the try_compile
fails because -std=c++98 is being added after my -std=c++11. Is there a way to preseve the behavior from 3.16 ?
@tambre might have some idea what’s going on with this one.
tambre
(Raul Tambre)
October 7, 2022, 8:22pm
3
Please provide the resulting zipped build directory of a clean build with --debug-trycompile --trace --trace-expand --trace-redirect=trace.txt
.
However in cmake 3.24.1, the try_compile
fails because -std=c++98 is being added after my -std=c++11.
I presume this is with CMP0128
set to NEW
? If there’s a change with it still being OLD
then that’s a bug.
malaterre
(Mathieu Malaterre)
October 10, 2022, 7:39am
4
Here you go:
bad.tgz (131.3 KB)
good.tgz (116.7 KB)
Full code is:
cmake_minimum_required(VERSION 3.10)
if(POLICY CMP0128)
cmake_policy(SET CMP0128 OLD)
endif()
project(p VERSION 1.0.0)
set(CMAKE_CXX_EXTENSIONS OFF) # important
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
find_package(Atomics REQUIRED)
Use case:
Highway is not compiled with any particular CMAKE_CXX_STANDARD
set.
malaterre
(Mathieu Malaterre)
October 13, 2022, 6:43am
5
@tambre do you need any additional details ? thanks
tambre
(Raul Tambre)
October 13, 2022, 6:46am
6
Sorry, I’m simply very busy. Should hopefully have the time for a closer look over the weekend.
1 Like
tambre
(Raul Tambre)
October 15, 2022, 1:50pm
7
Would you be able to build CMake from source and bisect 3.16.3 and 3.24.2 for this issue?
I’ve combed through the CMP0128 implementation once again and I suspect this is more likely to have resulted from an earlier refactor.
malaterre
(Mathieu Malaterre)
October 18, 2022, 5:58am
8
Ok, then I’ll try to find some time then. I did report an issue to track progress, and communicate with upstream. Thanks