RPGXCXX-1 make static build toggleable by the option BUILD_STATIC

This commit is contained in:
Walter Julius Hennecke 2019-02-23 21:08:23 +01:00
parent 11570b5291
commit b5c4bd30fb
2 changed files with 9 additions and 6 deletions

View file

@ -3,4 +3,9 @@ project(rpgxEF LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(BUILD_STATIC false CACHE BOOL "whether to create static binaries")
if(WIN32)
set(BUILD_STATIC true CACHE BOOL "whether to create static binaries")
endif(WIN32)
add_subdirectory(code)

View file

@ -22,13 +22,11 @@ else ()
message(FATAL_ERROR "Unknown processor:" ${CMAKE_SYSTEM_PROCESSOR})
endif ()
if(UNIX)
set(UI_LINKER_OPTIONS -lstdc++fs)
endif(UNIX)
if(WIN32)
set(UI_LINKER_OPTIONS -static -static-libgcc -static-libstdc++ -lstdc++fs)
endif(WIN32)
set(UI_LINKER_OPTIONS -lstdc++fs)
if(BUILD_STATIC)
set(UI_LINKER_OPTIONS -static -static-libgcc -static-libstdc++ ${UI_LINKER_OPTIONS})
endif(BUILD_STATIC)
set(UI_LIB_NAME "ui${ARCH}")