CMake: remove a compile flag from CMAKE_C_FLAGS_RELEASE only for a specific target

407 Views Asked by At

I have

set(CMAKE_CXX_FLAGS_RELEASE "-O3 -m64 -march=native -flto")

but I'd like to remove -flto for a specific target compilation:

file(GLOB TST_SOURCES "${CMAKE_SOURCE_DIR}/x64_test/*.cpp")
add_executable(_x64_test ${TST_SOURCES})
target_compile_options(_x64_test PRIVATE -Wall -DLITTLE_ENDIAN)
target_link_libraries(_x64_test PRIVATE test_iface pthread m)

Is it possible?

0

There are 0 best solutions below