1- cmake_minimum_required (VERSION 3.5)
2-
1+ cmake_minimum_required (VERSION 3.16)
32project (softhsm2 C CXX)
43
54# Build Options
@@ -8,8 +7,8 @@ option(DISABLE_NON_PAGED_MEMORY "Disable non-paged memory for secure storage" OF
87option (DISABLE_VISIBILITY "Disables and unsets -fvisibility=hidden" OFF )
98option (ENABLE_64bit "Enable 64-bit compiling" OFF )
109option (ENABLE_ECC "Enable support for ECC" ON )
11- option (ENABLE_EDDSA "Enable support for EDDSA" OFF )
12- option (ENABLE_GOST "Enable support for GOST" ON )
10+ option (ENABLE_EDDSA "Enable support for EDDSA" ON )
11+ option (ENABLE_GOST "Enable support for GOST" OFF )
1312option (ENABLE_FIPS "Enable support for FIPS 140-2 mode" OFF )
1413option (ENABLE_P11_KIT "Enable p11-kit integration" ON )
1514option (ENABLE_PEDANTIC "Enable pedantic compile mode" OFF )
@@ -51,7 +50,7 @@ set(DEFAULT_LOG_LEVEL "INFO"
5150 CACHE STRING "The default log level" )
5251set (DEFAULT_OBJECTSTORE_BACKEND "file"
5352 CACHE STRING "Default storage backend for token objects" )
54- set (DEFAULT_PKCS11_LIB "${CMAKE_INSTALL_FULL_LIBDIR} /softhsm/libsofthsm2.so "
53+ set (DEFAULT_PKCS11_LIB "${CMAKE_INSTALL_FULL_LIBDIR} /softhsm/libsofthsm2${CMAKE_SHARED_LIBRARY_SUFFIX} "
5554 CACHE STRING "The default PKCS#11 library" )
5655set (DEFAULT_SOFTHSM2_CONF "${CMAKE_INSTALL_FULL_SYSCONFDIR} /softhsm2.conf"
5756 CACHE STRING "The default location of softhsm.conf" )
@@ -80,11 +79,37 @@ if(NOT CMAKE_BUILD_TYPE)
8079 set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Default build type for SoftHSMv2 project" FORCE)
8180endif (NOT CMAKE_BUILD_TYPE )
8281
82+
83+ set (CMAKE_CXX_FLAGS_MAINTAINER "-Wall -Wabi" CACHE STRING
84+ "Flags used by the C++ compiler during maintainer builds."
85+ FORCE)
86+ set (CMAKE_C_FLAGS_MAINTAINER "-Wall -pedantic" CACHE STRING
87+ "Flags used by the C compiler during maintainer builds."
88+ FORCE)
89+ set (CMAKE_EXE_LINKER_FLAGS_MAINTAINER
90+ "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
91+ "Flags used for linking binaries during maintainer builds."
92+ FORCE)
93+ set (CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
94+ "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
95+ "Flags used by the shared libraries linker during maintainer builds."
96+ FORCE)
97+ mark_as_advanced (
98+ CMAKE_CXX_FLAGS_MAINTAINER
99+ CMAKE_C_FLAGS_MAINTAINER
100+ CMAKE_EXE_LINKER_FLAGS_MAINTAINER
101+ CMAKE_SHARED_LINKER_FLAGS_MAINTAINER)
102+
103+ set (CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE} " CACHE STRING
104+ "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Maintainer."
105+ FORCE)
106+
107+
83108message (STATUS "Build Configuration: ${CMAKE_BUILD_TYPE} " )
84109
85110# Build Modules Path
86111set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
87- ${CMAKE_SOURCE_DIR} /modules
112+ ${CMAKE_SOURCE_DIR} /cmake/ modules
88113 )
89114
90115# Custom Modules
@@ -102,6 +127,7 @@ add_subdirectory(src)
102127# p11-kit
103128set (default_softhsm2_lib ${DEFAULT_PKCS11_LIB} )
104129configure_file (softhsm2.module.in softhsm2.module)
130+
105131if (ENABLE_P11_KIT)
106132 install (FILES ${PROJECT_BINARY_DIR} /softhsm2.module
107133 DESTINATION ${P11KIT_PATH}
0 commit comments