Add build options related to executable generation

This commit is contained in:
David Hrdlička
2021-12-21 18:05:12 +01:00
parent f9ef6a2408
commit 9f03225e5a
2 changed files with 50 additions and 15 deletions

View File

@@ -64,9 +64,11 @@ if(WIN32 AND ARCH STREQUAL "i386")
endif()
endif()
if(MINGW)
target_link_options(86Box PRIVATE "-static")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ".dll.a")
if(STATIC_BUILD)
if(MINGW OR UNIX)
target_link_options(86Box PRIVATE "-static")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
endif()
endif()
if(APPLE)
@@ -91,7 +93,7 @@ target_link_libraries(86Box ${OPENAL_LIBRARY})
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
if(WIN32 AND TARGET SDL2::SDL2-static)
if(STATIC_BUILD AND TARGET SDL2::SDL2-static)
target_link_libraries(86Box SDL2::SDL2-static)
elseif(TARGET SDL2::SDL2)
target_link_libraries(86Box SDL2::SDL2)
@@ -143,7 +145,7 @@ if(MINITRACE)
target_link_libraries(86Box minitrace)
endif()
if(WIN32 OR APPLE)
if(WIN32 OR (APPLE AND CMAKE_MACOSX_BUNDLE))
# Copy the binary to the root of the install prefix on Windows and macOS
install(TARGETS 86Box DESTINATION ".")
else()