Improving CMakeLists.txt thanks to Andy
This commit is contained in:
parent
eee9b2dc38
commit
6314bc756a
@ -1,21 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
set(This Chess)
|
||||
project(${This} C CXX)
|
||||
project(Chess C CXX)
|
||||
|
||||
enable_language(CXX)
|
||||
# set(SDL2_INCLUDE_DIR /usr/include/SDL2)
|
||||
# set(SDL2_LIBRARY /usr/lib/x86_64-linux-gnu/libSDL2.so)
|
||||
# list(APPEND CMAKE_MODULE_PATH SDL2_INCLUDE_DIR)
|
||||
# list(APPEND CMAKE_MODULE_PATH SDL2_LIBRARY)
|
||||
#list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2)
|
||||
find_package(SDL2 REQUIRED)
|
||||
|
||||
|
||||
file(GLOB FILES
|
||||
file(GLOB sources
|
||||
CONFIGURE_DEPENDS
|
||||
src/*.cpp)
|
||||
|
||||
add_executable(${This} ${FILES})
|
||||
include_directories(${SDL2_INCLUDE_DIRS})
|
||||
target_link_libraries(${This} ${SDL2_LIBRARIES})
|
||||
|
||||
add_executable(Chess ${sources})
|
||||
set_target_properties(Chess PROPERTIES CXX_STANDARD 17) # set standard level
|
||||
target_compile_options(Chess PRIVATE
|
||||
-Wall -Wextra -Wredundant-decls -Wcast-align
|
||||
-Wshadow -Wnon-virtual-dtor
|
||||
-Wunused -Woverloaded-virtual -Wpedantic -Wconversion
|
||||
-Wsign-conversion -Wmisleading-indentation
|
||||
-Wnull-dereference -Wformat=2
|
||||
)
|
||||
target_link_libraries(Chess SDL2::SDL2)
|
||||
|
Loading…
Reference in New Issue
Block a user