@@ -50,26 +50,29 @@ endif()
5050add_subdirectory (src)
5151
5252# Open OCPP static library
53- add_library (open-ocpp-static STATIC
54- src/version .cpp)
55- target_link_libraries (open-ocpp-static
56- centralsystem
57- chargepoint
58- config
59- database
60- messages
61- rpc
62- helpers
63- log
64- version
65- x509
66- json
67- ws
68- websockets
69-
70- dl
71- )
72- set_target_properties (open-ocpp-static PROPERTIES OUTPUT_NAME "open-ocpp_static" )
53+ if (${BUILD_STATIC_LIBRARY} )
54+ add_library (open-ocpp-static STATIC
55+ src/version .cpp)
56+ target_link_libraries (open-ocpp-static
57+ centralsystem
58+ chargepoint
59+ config
60+ database
61+ messages
62+ rpc
63+ helpers
64+ log
65+ version
66+ x509
67+ json
68+ ws
69+ websockets
70+
71+ dl
72+ )
73+ set_target_properties (open-ocpp-static PROPERTIES OUTPUT_NAME "open-ocpp_static" )
74+ set (OPEN_OCPP_STATIC_TARGET open-ocpp-static )
75+ endif ()
7376
7477# Open OCPP dynamic library
7578add_library (open-ocpp-dynamic SHARED
@@ -98,7 +101,7 @@ include(GNUInstallDirs)
98101
99102file (GLOB_RECURSE PUBLIC_HEADERS RELATIVE ${CMAKE_SOURCE_DIR} "src/*.h" )
100103
101- install (TARGETS open-ocpp-static open-ocpp- dynamic
104+ install (TARGETS open-ocpp-dynamic ${OPEN_OCPP_STATIC_TARGET}
102105 EXPORT LibOpenOcppTargets
103106
104107 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
@@ -120,9 +123,11 @@ configure_file(
120123)
121124install (FILES "${CMAKE_BINARY_DIR} /libopen-ocpp.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR} /pkgconfig)
122125
123- set (LIB_NAME "open-ocpp_static" )
124- configure_file (
125- "${CMAKE_CURRENT_SOURCE_DIR} /libopen-ocpp.pc.in"
126- "${CMAKE_CURRENT_BINARY_DIR} /libopen-ocpp_static.pc"
127- )
128- install (FILES "${CMAKE_BINARY_DIR} /libopen-ocpp_static.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR} /pkgconfig)
126+ if (${BUILD_STATIC_LIBRARY} )
127+ set (LIB_NAME "open-ocpp_static" )
128+ configure_file (
129+ "${CMAKE_CURRENT_SOURCE_DIR} /libopen-ocpp.pc.in"
130+ "${CMAKE_CURRENT_BINARY_DIR} /libopen-ocpp_static.pc"
131+ )
132+ install (FILES "${CMAKE_BINARY_DIR} /libopen-ocpp_static.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR} /pkgconfig)
133+ endif ()
0 commit comments