Jelajahi Sumber

define the root-cmake-script

Sven Czarnian 3 tahun lalu
induk
melakukan
6caf47886a
1 mengubah file dengan 53 tambahan dan 0 penghapusan
  1. 53 0
      CMakeLists.txt

+ 53 - 0
CMakeLists.txt

@@ -0,0 +1,53 @@
+# Author:
+#   Sven Czarnian <devel@svcz.de>
+# License:
+#   GPLv3
+# Brief:
+#   Creates the AMAN-EuroScope solution
+
+CMAKE_MINIMUM_REQUIRED(VERSION 3.14)
+
+# define the project information
+PROJECT(ArrivalMANager LANGUAGES CXX VERSION "0.1.0")
+
+# define the language parameters
+SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
+SET(CMAKE_CXX_STANDARD 20)
+SET(CMAKE_CXX_STANDARD_REQUIRED ON)
+SET(CMAKE_CXX_EXTENSIONS OFF)
+SET(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
+
+# adapt compiler flags based on used compiler
+IF (MSVC)
+    IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
+        STRING(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+    ELSE ()
+        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
+    ENDIF ()
+    IF (NOT CMAKE_CXX_FLAGS MATCHES "/MP")
+        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
+        SET(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} /MP")
+    ENDIF ()
+
+    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /sdl /permissive- /DNOMINMAX")
+    SET(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} /sdl /permissive- /DNOMINMAX")
+    SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFESTUAC:NO")
+    ADD_DEFINITIONS(/D_USRDLL /D_CRT_SECURE_NO_WARNINGS)
+ENDIF ()
+
+# define include directories
+INCLUDE_DIRECTORIES(
+    ${CMAKE_SOURCE_DIR}/include
+    ${CMAKE_BINARY_DIR}/include
+)
+
+INCLUDE(cmake/3rdParty.cmake)
+INCLUDE(cmake/Protobuf.cmake)
+INCLUDE(cmake/FindEuroScope.cmake)
+
+# register all cmake helper to find required modules and find 3rd-party components
+SET(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake")
+FIND_PACKAGE(EuroScope REQUIRED)
+IF(NOT EuroScope_FOUND)
+    MESSAGE(FATAL_ERROR "Unablet to build without EuroScope and the EuroScope-SDK")
+ENDIF()