From cba4b0701c34033b03f153478c55ce0f39899005 Mon Sep 17 00:00:00 2001
From: Franck Dary <franck.dary@lis-lab.fr>
Date: Tue, 25 Jun 2019 11:51:29 +0200
Subject: [PATCH] Updated CMAKE

---
 CMakeLists.txt             | 10 ++++++++++
 decoder/CMakeLists.txt     |  2 +-
 maca_common/CMakeLists.txt |  4 ++--
 trainer/CMakeLists.txt     |  2 +-
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e77f471..3552d64 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,16 @@ find_package(Boost REQUIRED COMPONENTS program_options)
 find_package(fasttext REQUIRED)
 find_package(Doxygen REQUIRED)
 
+include_directories(${DYNET_INCLUDE_DIR})
+include_directories(${FASTTEXT_INCLUDE_DIR})
+
+add_library(Boost SHARED IMPORTED)
+set_target_properties(Boost PROPERTIES IMPORTED_LOCATION ${Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE})
+add_library(dynet SHARED IMPORTED)
+set_target_properties(dynet PROPERTIES IMPORTED_LOCATION ${DYNET_LIBRARY})
+add_library(fasttext SHARED IMPORTED)
+set_target_properties(fasttext PROPERTIES IMPORTED_LOCATION ${FASTTEXT_LIBRARY})
+
 set(CMAKE_VERBOSE_MAKEFILE 0)
 set(CMAKE_CXX_STANDARD 11)
 
diff --git a/decoder/CMakeLists.txt b/decoder/CMakeLists.txt
index e93aa50..61021d7 100644
--- a/decoder/CMakeLists.txt
+++ b/decoder/CMakeLists.txt
@@ -3,7 +3,7 @@ FILE(GLOB SOURCES src/*.cpp)
 add_executable(macaon_decode src/macaon_decode.cpp)
 target_link_libraries(macaon_decode transition_machine)
 target_link_libraries(macaon_decode decoder)
-target_link_libraries(macaon_decode ${Boost_PROGRAM_OPTIONS_LIBRARY})
+target_link_libraries(macaon_decode Boost)
 target_link_libraries(macaon_decode errors)
 install(TARGETS macaon_decode DESTINATION bin)
 
diff --git a/maca_common/CMakeLists.txt b/maca_common/CMakeLists.txt
index 80ff9b5..1f66e6e 100644
--- a/maca_common/CMakeLists.txt
+++ b/maca_common/CMakeLists.txt
@@ -1,12 +1,12 @@
 FILE(GLOB SOURCES src/*.cpp)
 
 add_executable(macaon_compute_l_rules src/macaon_compute_l_rules.cpp)
-target_link_libraries(macaon_compute_l_rules ${Boost_PROGRAM_OPTIONS_LIBRARY})
+target_link_libraries(macaon_compute_l_rules Boost)
 target_link_libraries(macaon_compute_l_rules maca_common)
 install(TARGETS macaon_compute_l_rules DESTINATION bin)
 
 add_executable(macaon_convert_embeddings src/macaon_convert_embeddings.cpp)
-target_link_libraries(macaon_convert_embeddings ${Boost_PROGRAM_OPTIONS_LIBRARY})
+target_link_libraries(macaon_convert_embeddings Boost)
 target_link_libraries(macaon_convert_embeddings maca_common)
 target_link_libraries(macaon_convert_embeddings dynet)
 install(TARGETS macaon_convert_embeddings DESTINATION bin)
diff --git a/trainer/CMakeLists.txt b/trainer/CMakeLists.txt
index 51bcc45..67d6652 100644
--- a/trainer/CMakeLists.txt
+++ b/trainer/CMakeLists.txt
@@ -3,7 +3,7 @@ FILE(GLOB SOURCES src/*.cpp)
 add_executable(macaon_train src/macaon_train.cpp)
 target_link_libraries(macaon_train transition_machine)
 target_link_libraries(macaon_train trainer)
-target_link_libraries(macaon_train ${Boost_PROGRAM_OPTIONS_LIBRARY})
+target_link_libraries(macaon_train Boost)
 install(TARGETS macaon_train DESTINATION bin)
 
 #compiling library
-- 
GitLab