/usr/bin/clang++ -std=c++11;-Werror;-Wextra;-Wall;-Wconversion -g -o CMakeFiles/TilingGame.dir/src/streak.cc.o -c /home/arne/projects/tilinggame/src/streak.cc clang: error: no input files /bin/sh: -Werror: Kommando nicht gefunden. /bin/sh: -Wextra: Kommando nicht gefunden. /bin/sh: -Wall: Kommando nicht gefunden. /bin/sh: -Wconversion: Kommando nicht gefunden. CMakeFiles/TilingGame.dir/build.make:54: recipe for target 'CMakeFiles/TilingGame.dir/src/streak.cc.o' failed as you can see my shees sees the semicolon as the end of the command and then tries to interpret "-Werror" as a new command. How can I tell cmake to generate working makefiles instead of broken ones?
here is my CMakeLists.txt
project(TilingGame) cmake_minimum_required(VERSION 2.8) aux_source_directory(src SRC_LIST) add_executable(${PROJECT_NAME} ${SRC_LIST}) set(CMAKE_CXX_FLAGS -std=c++11 -Werror -Wextra -Wall -Wconversion) include(FindPkgConfig) PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2) PKG_SEARCH_MODULE(SDL2IMAGE REQUIRED SDL2_image) PKG_SEARCH_MODULE(SDL2MIXER REQUIRED SDL2_mixer) PKG_SEARCH_MODULE(SDL2TTF REQUIRED SDL2_ttf) PKG_SEARCH_MODULE(ZLIB REQUIRED zlib) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2_LIBRARIES} ${SDL2IMAGE_LIBRARIES} ${SDL2MIXER_LIBRARIES} ${SDL2TTF_LIBRARIES} ${ZLIB_LIBRARIES} tmxparser tinyxml)
target_compile_optionsinstead ofCMAKE_CXX_FLAGS. It offers better control over the scope of the flags and integrates more nicely with third-party CMake scripts.target_compile_options(${PROJECT_NAME} PUBLIC -std=c++11 -Werror -Wextra -Wall -Wconversion). Note that this approach also works without the quotes.