Overriding of CMAKE_CXX_FLAGS #1306
Replies: 1 comment
-
Hmm, never mind, I didn't understand how the CMAKE_CXX_FLAGS worked. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
From what I can see you override if CMAKE_CXX_FLAGS. There's a flag you provide:
option(OVERRIDE_CXX_FLAGS "Override CMAKE_CXX_FLAGS_DEBUG/RELEASE" ON)
Then in two places you check that flag:
But in many places all over the file it's modified anyway. Is this the intent? It's very strange. Use of CMAKE_CXX_FLAGS is discouraged from the many places I've researched about it. The recommended way is to use commands such as target_compile_options. See here
What I think what would be good (I'm not that experienced but from what I've seen the general way of doing it is), declare target for Jolt at the top of the file:
add_library(jolt_library_target)
Then throughout the CMake file go about setting the options:
target_compile_options(jolt_library_target PRIVATE "option1 option2")
Beta Was this translation helpful? Give feedback.
All reactions