Skip to content

Commit bc320a5

Browse files
KawamuraKawamura
authored andcommitted
Handle Boost library linking
1 parent 705374f commit bc320a5

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

CMakeLists.txt

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,39 @@
1-
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
1+
cmake_minimum_required (VERSION 3.0)
22

3-
PROJECT(sdk-dslink-cpp)
3+
project (sdk-dslink-cpp)
44

5-
IF(WIN32)
5+
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
66

7-
set(Boost_DEBUG ON)
8-
SET(BOOST_ROOT C:\\local\\boost_1_64_0)
9-
SET(BOOST_INCLUDEDIR ${BOOST_ROOT}\\include\\boost-1_64)
7+
if (WIN32)
108

11-
SET(Boost_USE_STATIC_LIBS ON)
12-
SET(Boost_USE_MULTITHREAD ON)
13-
SET(Boost_USE_STATIC_RUNTIME OFF)
9+
#-------------------------------------------------
10+
# Boost
11+
#
1412

15-
FIND_PACKAGE(Boost 1.64.0)
16-
IF(Boost_FOUND)
17-
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
18-
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
19-
ENDIF(Boost_FOUND)
13+
set (Boost_DEBUG ON)
14+
set (BOOST_ROOT C:\\local\\boost_1_64_0)
15+
set (BOOST_INCLUDEDIR ${BOOST_ROOT}\\include\\boost-1_64)
2016

21-
ADD_EXECUTABLE(bt_main bt_main.cpp)
17+
set (Boost_NO_SYSTEM_PATHS ON)
18+
set (Boost_USE_STATIC_LIBS ON)
19+
set (Boost_USE_MULTITHREAD ON)
20+
set (Boost_USE_STATIC_RUNTIME OFF)
2221

23-
ENDIF(WIN32)
22+
set (BOOST_LIBS system)
23+
24+
find_package (Boost 1.64.0 REQUIRED COMPONENTS ${BOOST_LIBS})
25+
if (Boost_FOUND)
26+
include_directories (${Boost_INCLUDE_DIRS})
27+
link_directories (${Boost_LIBRARY_DIRS})
28+
endif (Boost_FOUND)
29+
30+
set (USED_LIBS ${BOOST_LIBRARIES})
31+
32+
#-------------------------------------------------
33+
# Build
34+
#
35+
36+
# add_executable (bt_main bt_main.cpp)
37+
# target_link_libraries (bt_main ${USED_LIBS})
38+
39+
endif (WIN32)

0 commit comments

Comments
 (0)