Reputation: 8481
/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)
Upvotes: 0
Views: 771
Reputation: 594
You can only add strings/append strings to CMAKE_CXX_FLAGS
, but not lists.
The following should work:
set(CMAKE_CXX_FLAGS "-std=c++11 -Werror -Wextra -Wall -Wconversion")
Upvotes: 1
Reputation: 100781
Since you don't show us the section of your cmake file where you are adding those flags we can't say exactly. However, clearly somehow you're causing cmake to convert a list of values into a string and then using that string as flags. The string-ified version of list variables in cmake are semicolon-separated.
For example maybe you have something like this in your CMakeLists.txt
:
set(FLAGS -std=c++11 -Werror -Wextra -Wall -Wconversion)
add_definitions("${FLAGS}")
You should not use the quotes here.
Upvotes: 2