I set the following flags in CMakeLists.txt
set(CMAKE_CXX_FLAGS "-std=c++14 -g -O0")
Then I use find_package to find Qt5Test
find_package(Qt5Test REQUIRED)
Then I create a Model Test
add_library (modeltest STATIC ${SRCS}) target_link_libraries(modeltest Qt5::Test)
For some reason, I get -fPIC -std=gnu++11 to my compiler flags
CMakeFiles/modeltest.dir/flags.make:CXX_FLAGS = -std=c++14 -g -O0 -fPIC -std=gnu++11
This is clobbering my flag -std=c++14 , as a result of which all C ++ 14 functions in my program end up as compiler errors:
error: 'foo' function uses 'auto' type specifier without trailing return type constexpr auto foo() ^ note: deduced return type only available with -std=c++14 or -std=gnu++14
- Is there any way to fix this?
- I am using the latest version of Qt 5.7, downloaded from their site today.
source share