Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cmake_minimum_required(VERSION 3.0.0)
- project(ConnectorSimulator VERSION 0.0.0)
- SET(CMAKE_C_COMPILER /usr/bin/clang)
- SET(CMAKE_CXX_COMPILER /usr/bin/clang++)
- set(CMAKE_VERBOSE_MAKEFILE ON)
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
- include(CTest)
- enable_testing()
- add_definitions(-std=c++11)
- add_definitions("-D_SCL_SECURE_NO_WARNINGS")
- add_definitions("-fPIE")
- #Static Start
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
- # Boost Include
- set(Boost_USE_STATIC_LIBS ON)
- find_package(Boost 1.61 COMPONENTS program_options system filesystem REQUIRED)
- # MySQL Include
- #set(FINDMYSQL_DEBUG ON)
- #set(MYSQLCLIENT_STATIC_LINKING ON)
- find_package(MySQL REQUIRED)
- #include_directories(${MySQL_INCLUDE_DIRS})
- set(MY_TARGET_LINK_LIBRARIES mysqlcppconn-static)
- set(MY_TARGET_LINK_LIBRARIES ${MY_TARGET_LINK_LIBRARIES} mysqlclient pthread z m rt atomic dl)
- #Static Linking
- set(BUILD_SHARED_LIBRARIES OFF)
- set(CMAKE_EXE_LINKER_FLAGS "-static")
- #Compiling
- add_executable(ConnectorSimulator main.cpp Database.cpp Database.h Worker.cpp Worker.h easylogging.h easylogging.cc)
- #Linking
- target_link_libraries(ConnectorSimulator Boost::program_options)
- target_link_libraries(ConnectorSimulator Boost::filesystem)
- target_link_libraries(ConnectorSimulator Boost::system)
- target_link_libraries(ConnectorSimulator ${MY_TARGET_LINK_LIBRARIES})
- set(CPACK_PROJECT_NAME ${PROJECT_NAME})
- set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
- include(CPack)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement