Skip to content
Snippets Groups Projects
CMakeLists.txt 2.03 KiB
cmake_minimum_required( VERSION 2.8.7 )

project( simmc-agent )

# version number
set ( VERSION_MAJOR 0 )
set ( VERSION_MINOR 0 )

if(UNIX)
	# cpr requires c++11
	set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
else(WIN32)
	add_definitions( -DBOOST_ALL_NO_LIB )
	set(Boost_USE_STATIC_LIBS ON)
	set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")


# src : main, collect functions  + jsoncpp library
file ( GLOB SOURCES src/agent/*.cpp )

# src : curl requests

# options for cpr
# avoid experimental use of openssl
option( CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" OFF )
# avoid building tests
option( BUILD_CPR_TESTS "Set to ON to build cpr tests." OFF )

# options for curl
# avoid building tests
option( BUILD_CURL_TESTS "Set to ON to build cURL tests." OFF )
# avoid running tests - set ON again in download version or if errors occur
option( RUN_CURL_TESTS "Set to ON to run cURL tests." OFF )
option( CURL_STATICLIB "Set to ON to generated curl statically." ON )

add_subdirectory ( lib/cpr )
include_directories ( ${CPR_INCLUDE_DIRS} )
include_directories ( ${CURL_INCLUDE_DIRS} )

# src : DtWinVer - Windows Version/Edition class
if ( WIN32 )
    # add_subdirectory ( lib/dtwinver )
endif ()

# headers
include_directories ( "include" )

# include headers from boost lib
include_directories ( "${CMAKE_BINARY_DIR}/include" )

# scr = libboost
include ( "modules/boost.cmake" )

# compile
set ( CMAKE_RUNTIME_OUTPUT_DIRECTORY "../bin" )
add_executable ( agent-v${VERSION_MAJOR}.${VERSION_MINOR} ${SOURCES} )
target_link_libraries ( agent-v${VERSION_MAJOR}.${VERSION_MINOR} ${CPR_LIBRARIES} ${CURL_LIBRARIES} ${FILESYSTEM_LIB} ${SYSTEM_LIB} ${REGEX_LIB} ${PROGRAM_OPTIONS_LIB})

add_dependencies ( agent-v${VERSION_MAJOR}.${VERSION_MINOR} Boost)

if ( WIN32 )
    # target_link_libraries ( agent-v${VERSION_MAJOR}.${VERSION_MINOR} dtwinver )
else ()
    # libudev
    target_link_libraries ( agent-v${VERSION_MAJOR}.${VERSION_MINOR} udev )
endif ()