feat(build): -D STATIC=ON option for building a static Lean executable
On Linux, -D STATIC=ON does not work if MULTI_THREAD support is enabled. If we search for "pthread static crash" we find other projects with the same problem. Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
29613e45ad
commit
e3403492a5
1 changed files with 7 additions and 0 deletions
|
@ -9,6 +9,8 @@ enable_testing()
|
||||||
option(TRACK_MEMORY_USAGE "TRACK_MEMORY_USAGE" ON)
|
option(TRACK_MEMORY_USAGE "TRACK_MEMORY_USAGE" ON)
|
||||||
option(MULTI_THREAD "MULTI_THREAD" ON)
|
option(MULTI_THREAD "MULTI_THREAD" ON)
|
||||||
option(BOOST "BOOST" OFF)
|
option(BOOST "BOOST" OFF)
|
||||||
|
option(STATIC "STATIC" OFF)
|
||||||
|
|
||||||
# Added for CTest
|
# Added for CTest
|
||||||
INCLUDE(CTest)
|
INCLUDE(CTest)
|
||||||
CONFIGURE_FILE(${LEAN_SOURCE_DIR}/CTestCustom.cmake.in
|
CONFIGURE_FILE(${LEAN_SOURCE_DIR}/CTestCustom.cmake.in
|
||||||
|
@ -32,6 +34,11 @@ else()
|
||||||
set(LEAN_EXTRA_CXX_FLAGS "${LEAN_EXTRA_CXX_FLAGS} -D LEAN_MULTI_THREAD")
|
set(LEAN_EXTRA_CXX_FLAGS "${LEAN_EXTRA_CXX_FLAGS} -D LEAN_MULTI_THREAD")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if("${STATIC}" MATCHES "ON")
|
||||||
|
set(LEAN_EXTRA_LINKER_FLAGS "${LEAN_EXTRA_LINKER_FLAGS} -static")
|
||||||
|
message(STATUS "Creating a static executable")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Set Module Path
|
# Set Module Path
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue