#---------------------------------------------------------------------------- # Setup the project cmake_minimum_required(VERSION 2.6 FATAL_ERROR) project(Saffron CXX) if (${SETUP} STREQUAL "T2B") message("Setup for : T2B") set(MYSQL_INCLUDE_DIR "mysql-connector-c++-1.1.8-linux-glibc2.5-x86-64bit/include/cppconn") set(MYSQL_LIBRARIES "mysql-connector-c++-1.1.8-linux-glibc2.5-x86-64bit/lib/libmysqlcppconn.so") elseif (${SETUP} STREQUAL "Caen") message("Setup for : Caen") set(MYSQL_INCLUDE_DIR "../mysql-connector-c++-1.1.7/cppconn") set(MYSQL_LIBRARIES "../mysql-connector-c++-1.1.7/driver/libmysqlcppconn.so") else () message("No setup selected, automatically set to T2B") set(MYSQL_INCLUDE_DIR "mysql-connector-c++-1.1.8-linux-glibc2.5-x86-64bit/include/cppconn") set(MYSQL_LIBRARIES "mysql-connector-c++-1.1.8-linux-glibc2.5-x86-64bit/lib/libmysqlcppconn.so") endif() #Compiler flags set(CMAKE_CXX_FLAGS "-std=c++11 -O3 -g -Wno-reorder -Wno-deprecated") message("CXX compiler flags are : ${CMAKE_CXX_FLAGS}") #Set shared object as imported library add_library( mysql SHARED IMPORTED GLOBAL) set_target_properties( mysql PROPERTIES IMPORTED_LOCATION ${MYSQL_LIBRARIES}) #Find the ROOT setup package find_package(ROOT REQUIRED) include(${ROOT_USE_FILE}) #List include directory include_directories(${LD_LIBRARY_PATH} ${PROJECT_SOURCE_DIR}/src ${ROOT_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR}) #Get recursively source and header files file(GLOB_RECURSE sources ${PROJECT_SOURCE_DIR}/src/*.cpp) file(GLOB_RECURSE headers ${PROJECT_SOURCE_DIR}/src/*.h) add_executable(saffron src/main.cpp ${sources} ${headers}) target_link_libraries(saffron ${ROOT_LIBRARIES} mysql)