Mario: add sdlpp as a subdirectory instead of ExternalProject
This commit is contained in:
parent
509e5e36c2
commit
8e566ddb03
@ -3,7 +3,6 @@ set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
enable_language(CXX)
|
||||
include(ExternalProject)
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
@ -19,20 +18,8 @@ list(APPEND CommonFiles
|
||||
mario.cpp
|
||||
blocks.cpp
|
||||
)
|
||||
set(SDLPPDir ${CMAKE_CURRENT_SOURCE_DIR}/../sdlpp)
|
||||
|
||||
add_library(sdlpp STATIC IMPORTED)
|
||||
set_target_properties(sdlpp PROPERTIES
|
||||
IMPORTED_LOCATION libsdlpp.a
|
||||
)
|
||||
|
||||
ExternalProject_Add(sdlpp_external
|
||||
SOURCE_DIR ${SDLPPDir}
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND make libsdlpp.a
|
||||
BUILD_IN_SOURCE 1
|
||||
INSTALL_COMMAND install -m 644 "${SDLPPDir}/libsdlpp.a" ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
add_subdirectory(../sdlpp sdlpp)
|
||||
|
||||
add_executable(mario
|
||||
${CommonFiles}
|
||||
@ -53,10 +40,8 @@ add_executable(editor
|
||||
)
|
||||
|
||||
target_compile_definitions(editor PUBLIC EDITOR)
|
||||
target_link_libraries(mario PRIVATE sdlpp)
|
||||
target_link_libraries(editor PRIVATE sdlpp)
|
||||
|
||||
target_link_libraries(mario PRIVATE SDL2 SDL2_image SDL2_gfx SDL2_ttf Threads::Threads)
|
||||
target_link_libraries(editor PRIVATE SDL2 SDL2_image SDL2_gfx SDL2_ttf Threads::Threads)
|
||||
target_link_libraries(mario PRIVATE sdlpp SDL2 SDL2_image SDL2_gfx SDL2_ttf Threads::Threads)
|
||||
target_link_libraries(editor PRIVATE sdlpp SDL2 SDL2_image SDL2_gfx SDL2_ttf Threads::Threads)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/testfont.ttf ${CMAKE_CURRENT_SOURCE_DIR}/sprites DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
Loading…
Reference in New Issue
Block a user