I am setting the following flags in my CMakeLists.txt
set(CMAKE_CXX_FLAGS "-std=c++14 -g -O0")
I am then using find_package
to locate Qt5Test
find_package(Qt5Test REQUIRED)
I am then creating a Model Test library
add_library (modeltest STATIC ${SRCS})
target_link_libraries(modeltest Qt5::Test)
For some reason I'm getting -fPIC -std=gnu++11
added to my compiler flags
CMakeFiles/modeltest.dir/flags.make:CXX_FLAGS = -std=c++14 -g -O0 -fPIC -std=gnu++11
This is clobbering my -std=c++14
flag, causing all the c++14 features in my program to 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 a way to fix this?
- I'm using the latest version of Qt 5.7 downloaded from their site today