add_definitions(-DCYNARA_VERSION="${CYNARA_VERSION}")
-set(SYSTEMD ON CACHE BOOL "should use systemd")
+option(WITH_SYSTEMD "should include systemd compatibility" ON)
+option(WITH_CYNARA_COMPAT "produce artifacts for compatibility with cynara" OFF)
+
set(DEFAULT_DB_DIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/cynara"
CACHE PATH "directory path of the database")
set(DEFAULT_SOCKET_DIR "${CMAKE_INSTALL_FULL_RUNSTATEDIR}/cynara"
###########################################################################
-include_directories(include)
link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined)
add_compile_options(-Wall -Wextra -Wconversion)
add_compile_options(-Werror=maybe-uninitialized)
add_compile_options(-Werror=implicit-function-declaration)
add_compile_options(-ffunction-sections -fdata-sections)
-add_compile_options(-fPIC)
-add_compile_options(-g)
-add_compile_options(-fstack-protector -D_FORTIFY_SOURCE=2 -O2)
-add_compile_options(-ffile-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}=.)
-
-set(CMAKE_C_FLAGS_PROFILING "-g -O2 -pg")
-set(CMAKE_C_FLAGS_DEBUG "-g -ggdb --fstack-protector -D_FORTIFY_SOURCE=2")
-set(CMAKE_C_FLAGS_RELEASE "-g -O2")
-set(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage")
+add_compile_options(-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.)
###########################################################################
-if(SYSTEMD)
+if(WITH_SYSTEMD)
PKG_CHECK_MODULES(libsystemd REQUIRED libsystemd>=222)
add_subdirectory(systemd)
endif()
-add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(pkgconfig)
+if(WITH_CYNARA_COMPAT)
+ add_subdirectory(compat)
+endif()
+
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/cynara.initial
DESTINATION
--- /dev/null
+###########################################################################
+# Copyright (C) 2018 "IoT.bzh"
+#
+# author: José Bollo <jose.bollo@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+add_subdirectory(src)
+add_subdirectory(include)
+add_subdirectory(pkgconfig)
--- /dev/null
+###########################################################################
+# Copyright (C) 2018 "IoT.bzh"
+#
+# author: José Bollo <jose.bollo@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+configure_file(cynara-compat.pc.in cynara-compat.pc @ONLY)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cynara-compat.pc
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+
+foreach(item cynara-admin.pc
+ cynara-agent.pc
+ cynara-client-async.pc
+ cynara-client.pc
+ cynara-commons.pc
+ cynara-creds-commons.pc
+ cynara-creds-dbus.pc
+ cynara-creds-gdbus.pc
+ cynara-creds-self.pc
+ cynara-creds-socket.pc
+ cynara-monitor.pc
+ cynara-plugin.pc
+ cynara-session.pc)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/link-to-cynara-compat.pc
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
+ RENAME ${item})
+endforeach(item)
+
--- /dev/null
+###########################################################################
+# Copyright (C) 2018 "IoT.bzh"
+#
+# author: José Bollo <jose.bollo@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+add_compile_definitions(_GNU_SOURCE)
+
+###########################################
+# build and install libcynara-compat
+###########################################
+add_library(cynara-compat SHARED lib-compat.c)
+target_include_directories(cynara-compat PUBLIC ../include)
+set_target_properties(cynara-compat
+ PROPERTIES
+ VERSION ${CYNARA_VERSION}
+ SOVERSION ${CYNARA_SOVERSION}
+)
+target_link_libraries(cynara-compat
+ PRIVATE cynara-client
+)
+target_link_options(cynara-compat
+ PRIVATE
+ -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-cynara-compat.map
+)
+install(TARGETS cynara-compat LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
+
+###########################################
+# build and install test-old-cynara
+###########################################
+add_executable(test-old-cynara main-test-old-cynara.c)
+target_link_libraries(test-old-cynara cynara-compat)
+install(TARGETS test-old-cynara
+ RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cynara.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-
-configure_file(cynara-compat.pc.in cynara-compat.pc @ONLY)
-
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cynara-compat.pc
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-
-foreach(item cynara-admin.pc
- cynara-agent.pc
- cynara-client-async.pc
- cynara-client.pc
- cynara-commons.pc
- cynara-creds-commons.pc
- cynara-creds-dbus.pc
- cynara-creds-gdbus.pc
- cynara-creds-self.pc
- cynara-creds-socket.pc
- cynara-monitor.pc
- cynara-plugin.pc
- cynara-session.pc)
- install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/link-to-cynara-compat.pc
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
- RENAME ${item})
-endforeach(item)
-
socket.c
)
-set(LIBCOMPAT_SOURCES
- lib-compat.c
-)
-
add_compile_definitions(_GNU_SOURCE)
###########################################
# build and install libcynara-core
###########################################
add_library(cynara-core SHARED ${LIBCORE_SOURCES})
+target_include_directories(cynara-core PUBLIC .)
set_target_properties(cynara-core PROPERTIES
VERSION ${CYNARA_VERSION}
SOVERSION ${CYNARA_SOVERSION})
target_link_libraries(cynara-core
+ PRIVATE
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-cynara-core.map
- -Wl,--as-needed
- -Wl,--gc-sections
)
install(TARGETS cynara-core LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
# build and install libcynara-client
###########################################
add_library(cynara-client SHARED ${LIBCLI_SOURCES})
+target_include_directories(cynara-client PUBLIC .)
target_compile_definitions(cynara-client PRIVATE
RCYN_DEFAULT_SOCKET_DIR="${DEFAULT_SOCKET_DIR}"
)
target_link_options(cynara-client
PRIVATE
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-cynara-client.map
- -Wl,--as-needed
- -Wl,--gc-sections
)
install(TARGETS cynara-client LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
install(FILES rcyn-client.h DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/cynara)
-###########################################
-# build and install libcynara-compat
-###########################################
-add_library(cynara-compat SHARED ${LIBCOMPAT_SOURCES})
-set_target_properties(cynara-compat PROPERTIES
- VERSION ${CYNARA_VERSION}
- SOVERSION ${CYNARA_SOVERSION})
-target_link_libraries(cynara-compat
- PRIVATE cynara-client
-)
-target_link_options(cynara-compat
- PRIVATE
- -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-cynara-compat.map
- -Wl,--as-needed
- -Wl,--gc-sections
-)
-install(TARGETS cynara-compat LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
-
###########################################
# build and install cynarad
###########################################
DEFAULT_INIT_FILE="${DEFAULT_INIT_FILE}"
RCYN_DEFAULT_SOCKET_DIR="${DEFAULT_SOCKET_DIR}"
)
-if(SYSTEMD)
+if(WITH_SYSTEMD)
target_compile_definitions(cynarad PRIVATE WITH_SYSTEMD_ACTIVATION)
target_link_libraries(cynarad ${libsystemd_LDFLAGS} ${libsystemd_LINK_LIBRARIES})
target_include_directories(cynarad PRIVATE ${libsystemd_INCLUDE_DIRS})
install(TARGETS cynadm
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
-###########################################
-# build and install test-old-cynara
-###########################################
-add_executable(test-old-cynara main-test-old-cynara.c)
-target_link_libraries(test-old-cynara cynara-compat)
-install(TARGETS test-old-cynara
- RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
-