Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kpu/kenlm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2016-02-29 00:47:24 +0300
committerKenneth Heafield <github@kheafield.com>2016-02-29 00:47:24 +0300
commitd7d122076b68c6c54e373444e43e267ba95b2213 (patch)
tree65622d965d724bee15da2bac77ed8a522f2d38e4
parente376c33efcac75ab2fb1f64790dacaec35bbd076 (diff)
Hacky? option to build static executables
-rw-r--r--CMakeLists.txt22
1 files changed, 19 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6f093cf..2c62bd5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,28 @@
cmake_minimum_required(VERSION 2.6)
# This CMake file was created by Lane Schwartz <dowobeha@gmail.com>
-
# Define a single cmake project
project(kenlm)
+option(FORCE_STATIC "Build static executables" OFF)
+if (FORCE_STATIC)
+ #presumably overkill, is there a better way?
+ #http://cmake.3232098.n2.nabble.com/Howto-compile-static-executable-td5580269.html
+ set(Boost_USE_STATIC_LIBS ON)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
+ set_property(GLOBAL PROPERTY LINK_SEARCH_START_STATIC ON)
+ set_property(GLOBAL PROPERTY LINK_SEARCH_END_STATIC ON)
+ set(BUILD_SHARED_LIBRARIES OFF)
+ set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
+ #Annoyingly the exectuables say "File not found" unless these are set
+ set(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS)
+ set(CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS)
+ set(CMAKE_SHARED_LIBRARY_C_FLAGS)
+ set(CMAKE_SHARED_LIBRARY_CXX_FLAGS)
+ set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
+ set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
+endif ()
+
# Compile all executables into bin/
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
@@ -32,8 +50,6 @@ find_package(Boost 1.36.0 REQUIRED COMPONENTS
)
-
-
# Define where include files live
include_directories(
${PROJECT_SOURCE_DIR}