Consider the following CMakeLists.txt (hello.cpp is some standard hello world
program)
cmake_minimum_required (VERSION 2.6)
project(HelloWorld)
add_executable(hello hello.cpp)
set(WARNING_FLAGS -Wno-char-subscripts -Wno-unused-local-typedefs)
#set(WARNING_FLAGS "-Wno-char-subscripts -Wno-unused-local-typedefs")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${WARNING_FLAGS}”)
When I try to run “cmake . -DCMAKE_BUILD_TYPE=RELEASE && make” - make fails
because there
are semi-colons in the command line. According to the FAQ
(https://cmake.org/Wiki/CMake_FAQ#Why_do_I_have_unwanted_semicolons_.3B_in_my_compiler_flags.3F
<https://cmake.org/Wiki/CMake_FAQ#Why_do_I_have_unwanted_semicolons_.3B_in_my_compiler_flags.3F>)
putting the list variable in quotes should cause it to be expanded with spaces,
but this doesn’t seem to occur.
If I replace the set(WARNING_FLAGS ..) with the commented out line, everything
works fine, but I’d rather not do this because it seems cleaner to use lists
for compiler options (can put them on multiple lines, append to them, etc).
What’s the right way to do this?
-Matt
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake