-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
91 lines (75 loc) · 2.54 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
cmake_minimum_required(VERSION 3.18)
project(GoobySoft)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
# Uncomment this if you want the debug mode activated
#add_compile_definitions(_GOOBYSOFT_DEBUG)
file(GLOB_RECURSE SOURCES "GoobySoft/*.cpp" "GoobySoft/*.c")
file(GLOB_RECURSE INCLUDES "GoobySoft/*.h")
add_executable(GoobySoft ${SOURCES})
include_directories(${INCLUDES})
# Hitta och länka mot libmodbus
find_library(LIBMODBUS_LIBRARY NAMES modbus)
if (LIBMODBUS_LIBRARY)
message("Libmodbus library found")
target_link_libraries(GoobySoft PRIVATE ${LIBMODBUS_LIBRARY})
else()
message(FATAL_ERROR "Libmodbus library not found")
endif()
# Hitta och länka mot MySQL C++ Connector
find_library(LIBMYSQLCPPCONN_LIBRARY NAMES mysqlcppconn8)
if (LIBMYSQLCPPCONN_LIBRARY)
message("MySQL C++ Connector 8 library found")
target_link_libraries(GoobySoft PRIVATE ${LIBMYSQLCPPCONN_LIBRARY})
else()
message(FATAL_ERROR "MySQL C++ Connector library not found")
endif()
# Hitta och länka mot libdl
find_library(LIBDL_LIBRARY NAMES dl)
if (LIBDL_LIBRARY)
message("libdl library found")
target_link_libraries(GoobySoft PRIVATE ${LIBDL_LIBRARY})
else()
message(FATAL_ERROR "libdl library not found")
endif()
# Hitta och länka mot SDL2
find_library(LIBSDL2_LIBRARY NAMES SDL2)
if (LIBSDL2_LIBRARY)
message("SDL2 library found")
target_link_libraries(GoobySoft PRIVATE ${LIBSDL2_LIBRARY})
else()
message(FATAL_ERROR "SDL2 library not found")
endif()
# Hitta och länka mot Pthreads
find_package(Threads REQUIRED)
if(Threads_FOUND)
message("PThread library found")
target_link_libraries(GoobySoft PRIVATE Threads::Threads)
else()
message(FATAL_ERROR "PThread library not found")
endif()
# Hitta och länka mot boost-asio
find_package(Boost REQUIRED COMPONENTS system)
if (Boost_FOUND)
message("Boost library found")
target_link_libraries(GoobySoft PRIVATE Boost::system)
else()
message(FATAL_ERROR "Boost library not found")
endif()
# Hitta och länka mot boost-filesystem
find_package(Boost REQUIRED COMPONENTS filesystem)
if (Boost_FOUND)
message("Boost Filesystem library found")
target_link_libraries(GoobySoft PRIVATE Boost::filesystem)
else()
message(FATAL_ERROR "Boost Filesystem library not found")
endif()
# Hitta och länka mot OpenGL
find_package(OpenGL REQUIRED)
if (OpenGL_FOUND)
message("OpenGL library found")
target_link_libraries(GoobySoft PRIVATE OpenGL::GL)
else()
message(FATAL_ERROR "OpenGL library not found")
endif()