I'm trying to change the flatbuffers library CMakeLists.txt to make PUBLIC some flags. Then, I've rewritten these lines:
Original code
elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -pedantic -Werror -Wextra")
endif()
New code
elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
target_compile_definitions(flatbuffers PUBLIC "-std=c++0x -Wall -pedantic -Werror -Wextra")
endif()
The target name is flatc and, when I start to build the project, I receive this:
Scanning dependencies of target flatc
[ 7%] Building CXX object CMakeFiles/flatc.dir/src/idl_parser.cpp.obj
<command-line>:0:1: error: macro names must be identifiers
Is it wrong the conversion of "set(CMAKE_CXX_FLAGS )" to "target_compile_definitions()" with these flags?