Added option to compile plasp statically.
This commit is contained in:
parent
b2ac47c2d3
commit
aec16f4407
@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.6)
|
|||||||
project(plasp CXX)
|
project(plasp CXX)
|
||||||
|
|
||||||
option(PLASP_BUILD_TESTS "Build unit tests" OFF)
|
option(PLASP_BUILD_TESTS "Build unit tests" OFF)
|
||||||
|
option(PLASP_BUILD_STATIC "Build static binaries" OFF)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic -Werror ${CMAKE_CXX_FLAGS}")
|
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic -Werror ${CMAKE_CXX_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-g ${CMAKE_CXX_FLAGS_DEBUG}")
|
set(CMAKE_CXX_FLAGS_DEBUG "-g ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||||
@ -14,6 +15,13 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
|||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||||
|
|
||||||
|
if(PLASP_BUILD_STATIC)
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "-static")
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||||
|
set(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS)
|
||||||
|
set(CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (CMAKE_GENERATOR STREQUAL "Ninja" AND
|
if (CMAKE_GENERATOR STREQUAL "Ninja" AND
|
||||||
((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) OR
|
((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) OR
|
||||||
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)))
|
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)))
|
||||||
|
Reference in New Issue
Block a user