Maximilien Siavelis
2018-01-05 17d71d9ef8adad095b8b06182bc1febca02899d0
CMakeLists.txt
@@ -2,7 +2,8 @@
#make it compatible with find_boost (exchange lowercase to camelcase)
#fix shared libraries activation
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
#cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
#version variables, major and minor must be 1 character only
SET(LICENSECC_MAJOR_VERSION 1)
@@ -28,7 +29,7 @@
   set(RELEASE_BUILD 0)
endif(CMAKE_BUILD_TYPE)
if(WIN32)
if(MSVC)
   SET(PLATFORM_LIBS "")
   include(target_arch)
@@ -42,7 +43,7 @@
   endif()
   SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib ) #${CMAKE_FIND_LIBRARY_SUFFIXES}
   add_definitions("/D_CRT_SECURE_NO_WARNINGS")
else(WIN32)
else(MSVC)
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe -fmessage-length=0 -std=c++11 -Wuninitialized -fPIC") #-Wall
    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe -fmessage-length=0 -Wall -Wuninitialized -fPIC") 
    #use static libraries in release to make it easier to distribute it
@@ -58,7 +59,7 @@
   IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
      SET(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Install path prefix" FORCE)
   ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
endif(WIN32)
endif(MSVC)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_DEBUG>)
@@ -68,24 +69,37 @@
  SET(HAVE_64BIT_SIZE_T 0)
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
include(add_boost)
add_boost(STATIC MODULES date_time test program_options system filesystem)
find_package(Boost 1.55.0 COMPONENTS date_time unit_test_framework program_options system filesystem)
#set below in case of dynamic linking in debug.
#set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:BOOST_TEST_DYN_LINK>)
add_definitions(-DBOOST_ALL_NO_LIB) #Disable Boost Microsoft magic, all dependencies are handled by cmake
add_definitions(-DBOOST_LIB_DIAGNOSTIC) #Check it is really disabled
if(NOT WIN32)
if(NOT MSVC)
   #find a static version of openssl crypto library
   find_package(OpenSSL REQUIRED)
   include_directories(${OPENSSL_INCLUDE_DIR})
   list(APPEND EXTERNAL_LIBS ${OPENSSL_CRYPTO_LIBRARY})
   FIND_PACKAGE(Dbus REQUIRED)
   include_directories(${DBUS_INCLUDE_DIR})
   include_directories(${DBUS_ARCH_INCLUDE_DIR})
   list(APPEND EXTERNAL_LIBS ${DBUS_LIBRARIES})
    if(MINGW)
        list(APPEND EXTERNAL_LIBS "-lcrypto -liphlpapi")
    else(MINGW)
        list(APPEND EXTERNAL_LIBS ${OPENSSL_CRYPTO_LIBRARY})
    endif(MINGW)
   MESSAGE(STATUS "Found openssl version ${OPENSSL_VERSION} ")
   #Zlib required when openssl version < 1.0.1f
   find_package(ZLIB REQUIRED)
   list(APPEND EXTERNAL_LIBS ${ZLIB_LIBRARIES})
   if(USE_DBUS_IDENTIFIER)
       FIND_PACKAGE(Dbus REQUIRED)
       add_definitions(-DUSE_DBUS)
       include_directories(${DBUS_INCLUDE_DIR})
       include_directories(${DBUS_ARCH_INCLUDE_DIR})
       list(APPEND EXTERNAL_LIBS ${DBUS_LIBRARIES})
   endif(USE_DBUS_IDENTIFIER)
   list(APPEND EXTERNAL_LIBS dl)
endif(NOT WIN32)
endif(NOT MSVC)
FIND_PACKAGE(Doxygen)
@@ -134,10 +148,10 @@
add_subdirectory(test)
#include(build/modules/CmakeDebugVariables.txt)
message("")
message( STATUS "C compiler: " ${CMAKE_C_COMPILER})
message( STATUS "C compiler flags: " ${CMAKE_C_FLAGS})
message( STATUS "CXX compiler: " ${CMAKE_CXX_COMPILER})
message( STATUS "CXX compiler flags: " ${CMAKE_CXX_FLAGS})
if(CMAKE_BUILD_TYPE)
  message( STATUS "Build type: " ${CMAKE_BUILD_TYPE})
endif(CMAKE_BUILD_TYPE)