Skip to content

Commit 80d7ef2

Browse files
committed
build: static compilation
1 parent 91cc1e4 commit 80d7ef2

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

CMakeLists.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -fsanitize=address,undefined
1010
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -D_FORTIFY_SOURCE=2")
1111

1212
find_package(PkgConfig)
13-
pkg_check_modules(BSON REQUIRED libbson-1.0)
14-
pkg_check_modules(CZMQ REQUIRED libczmq)
13+
pkg_check_modules(BSON_STATIC REQUIRED libbson-1.0)
14+
pkg_check_modules(CZMQ_STATIC REQUIRED libczmq)
1515
#pkg_check_modules(PFM REQUIRED libpfm)
1616

1717
set(SENSOR_SOURCES
@@ -33,9 +33,9 @@ set(SENSOR_SOURCES
3333
src/sensor.c
3434
)
3535

36-
set(SENSOR_INCLUDES "${CZMQ_INCLUDE_DIRS}")
37-
set(SENSOR_DEFINITIONS "${CZMQ_DEFINITIONS}")
38-
set(SENSOR_LIBRARIES "${CZMQ_LIBRARIES}" pfm)
36+
set(SENSOR_INCLUDES "${CZMQ_STATIC_INCLUDE_DIRS}")
37+
set(SENSOR_DEFINITIONS "${CZMQ_STATIC_DEFINITIONS}")
38+
set(SENSOR_LIBRARIES "${CZMQ_STATIC_LIBRARIES}" pfm)
3939

4040
if(WITH_MONGODB)
4141
pkg_check_modules(BSON REQUIRED libbson-1.0)
@@ -51,12 +51,13 @@ if(DEFINED ENV{GIT_TAG} AND DEFINED ENV{GIT_REV})
5151
add_definitions(-DVERSION_GIT_TAG="$ENV{GIT_TAG}" -DVERSION_GIT_REV="$ENV{GIT_REV}")
5252
endif()
5353

54+
5455
add_executable(hwpc-sensor "${SENSOR_SOURCES}")
5556

5657
target_include_directories(hwpc-sensor PRIVATE "${SENSOR_INCLUDES}")
5758
target_compile_definitions(hwpc-sensor PRIVATE "${SENSOR_DEFINITIONS}")
5859
target_link_libraries(hwpc-sensor "${SENSOR_LIBRARIES}")
5960

60-
target_include_directories (hwpc-sensor PRIVATE ${BSON_INCLUDE_DIRS})
61-
target_link_libraries (hwpc-sensor PRIVATE ${BSON_LIBRARIES})
62-
target_compile_definitions (hwpc-sensor PRIVATE ${BSON_DEFINITIONS})
61+
target_include_directories (hwpc-sensor PRIVATE ${BSON_STATIC_INCLUDE_DIRS})
62+
target_link_libraries (hwpc-sensor PRIVATE ${BSON_STATIC_LIBRARIES})
63+
target_compile_definitions (hwpc-sensor PRIVATE ${BSON_STATIC_DEFINITIONS})

0 commit comments

Comments
 (0)