I have a CMakeLists.txt like this:
project(MyProject)
add_subdirectory(SomeLibrary)
add_executable(MyProject ${SRC_FILES})
target_compile_options(MyProject PRIVATE -Werror -Wall)
target_link_libraries(MyProject SomeLibrary)
Where SomeLibrary is a 3rd party library (linked as a git submodule) that will fail to build with -Werror -Wall
I want to build my project with -Werror -Wall, but disable -Werror for the subproject. How can I do this?
I saw a related question, but that covers the case where the flags are set directly through CMAKE_CXX_FLAGS - not target_compile_options.