From 1b2f0b09cf7af498a6e33374feb2bfe8572383ca Mon Sep 17 00:00:00 2001 From: Giuseppe Roberti Date: Fri, 20 Sep 2019 18:40:21 +0200 Subject: [PATCH 1/2] Add CMakeLists.txt --- CMakeLists.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..049222a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.0) +project("rawgl") +add_executable(rawgl2 + aifcplayer.cpp engine.h graphics_soft.cpp pak.cpp resource_3do.h resource_win31.cpp screenshot.h staticres.cpp util.cpp + aifcplayer.h file.cpp intern.h pak.h resource_mac.cpp resource_win31.h script.cpp systemstub.h util.h + bitmap.cpp file.h main.cpp resource.cpp resource_mac.h scaler.cpp script.h systemstub_sdl.cpp video.cpp + bitmap.h graphics.h mixer.cpp resource.h resource_nth.cpp scaler.h sfxplayer.cpp unpack.cpp video.h + engine.cpp graphics_gl.cpp mixer.h resource_3do.cpp resource_nth.h screenshot.cpp sfxplayer.h unpack.h +) + +target_compile_options(rawgl2 PRIVATE -g -O -MMD -Wall -Wpedantic -DBYPASS_PROTECTION -DUSE_GL) +set_property(TARGET rawgl2 PROPERTY CXX_STANDARD 11) + +include(FindPkgConfig) + +pkg_search_module(SDL2 REQUIRED sdl2) +pkg_search_module(SDL2MIXER REQUIRED SDL2_mixer) + +find_library(GL OpenGL) +find_library(ZLIB z) + +include_directories(${SDL2_INCLUDE_DIRS}) +target_link_libraries(rawgl2 ${SDL2_LIBRARIES} ${SDL2MIXER_LIBRARIES} ${GL} ${ZLIB}) From 27d15fa6b32668da9b9cbf54143470bd53353173 Mon Sep 17 00:00:00 2001 From: Giuseppe Roberti Date: Sun, 22 Sep 2019 01:02:02 +0200 Subject: [PATCH 2/2] better to use target_include_directories and import target --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 049222a..ad97992 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,11 +13,11 @@ set_property(TARGET rawgl2 PROPERTY CXX_STANDARD 11) include(FindPkgConfig) -pkg_search_module(SDL2 REQUIRED sdl2) -pkg_search_module(SDL2MIXER REQUIRED SDL2_mixer) +pkg_search_module(SDL2 REQUIRED IMPORTED_TARGET sdl2) +pkg_search_module(SDL2MIXER REQUIRED IMPORTED_TARGET SDL2_mixer) find_library(GL OpenGL) find_library(ZLIB z) -include_directories(${SDL2_INCLUDE_DIRS}) -target_link_libraries(rawgl2 ${SDL2_LIBRARIES} ${SDL2MIXER_LIBRARIES} ${GL} ${ZLIB}) +target_include_directories(rawgl2 PUBLIC PkgConfig::SDL2) +target_link_libraries(rawgl2 PkgConfig::SDL2 PkgConfig::SDL2MIXER ${GL} ${ZLIB})