aboutsummaryrefslogtreecommitdiffstats
path: root/src/scvpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/scvpp')
-rw-r--r--src/scvpp/CMakeLists.txt18
-rw-r--r--src/scvpp/src/CMakeLists.txt12
2 files changed, 24 insertions, 6 deletions
diff --git a/src/scvpp/CMakeLists.txt b/src/scvpp/CMakeLists.txt
index 1256fc8..2dc42d6 100644
--- a/src/scvpp/CMakeLists.txt
+++ b/src/scvpp/CMakeLists.txt
@@ -16,8 +16,8 @@
cmake_minimum_required(VERSION 2.8)
project(scvpp)
-# add subdirectories
-add_subdirectory(src)
+# DEPENDENCIES
+##############
# enable testing if requested and possible
SET(ENABLE_TESTS 1 CACHE BOOL "Enable unit tests.")
@@ -32,9 +32,21 @@ if(ENABLE_TESTS)
endif(CMOCKA_FOUND)
endif(ENABLE_TESTS)
-find_package(PkgConfig QUIET)
+# COMPILER & LINKER & INSTALL
+#############################
+
+#define CMAKE_INSTALL_LIBDIR/INCLUDEDIR
+include(GNUInstallDirs)
+
+add_subdirectory(src)
+
+# MORE INSTALL
+##############
+
+find_package(PkgConfig QUIET) #QUIET disables message if not found
if(PKG_CONFIG_FOUND)
# generate and install pkg-config file
configure_file("libscvpp.pc.in" "libscvpp.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libscvpp.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
endif()
+
diff --git a/src/scvpp/src/CMakeLists.txt b/src/scvpp/src/CMakeLists.txt
index 6869a4b..71a891f 100644
--- a/src/scvpp/src/CMakeLists.txt
+++ b/src/scvpp/src/CMakeLists.txt
@@ -13,8 +13,6 @@
# limitations under the License.
#
-include(GNUInstallDirs)
-
# scvpp sources
set(SCVPP_SOURCES
sc_vpp_comm.c
@@ -33,7 +31,15 @@ set(SCVPP_HEADERS
sc_vpp_nat.h
)
-set(CMAKE_C_FLAGS " -g -O0 -fpic -fPIC -std=gnu99 -Wl,-rpath-link=/usr/lib")
+# Generate a compile_commands.json with compile options
+set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
+
+#set compiler and linker flags
+set(RIGOROUS_C_FLAGS "-Wlogical-op -Wformat=2")
+set(CMAKE_C_FLAGS "-Wall -Wextra -std=gnu99 ${RIGOROUS_C_FLAGS}")
+set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -std=gnu99 -g -O0 ${RIGOROUS_C_FLAGS}")
+#NDEBUG to skip assert checks
+set(CMAKE_C_FLAGS_RELEASE "-Wall -Wextra -std=gnu99 -DNDEBUG -O2 ${RIGOROUS_C_FLAGS}")
# libraries to link with
set(LINK_LIBRARIES vlibmemoryclient vapiclient vppapiclient svm vppinfra pthread rt dl)