63 lines
1.3 KiB
CMake
63 lines
1.3 KiB
CMake
cmake_minimum_required(VERSION 3.14)
|
|
|
|
include(cmake/prelude.cmake)
|
|
|
|
project(
|
|
ec-controller
|
|
VERSION 0.1.0
|
|
DESCRIPTION "Short description"
|
|
HOMEPAGE_URL "https://example.com/"
|
|
LANGUAGES CXX
|
|
)
|
|
|
|
include(cmake/project-is-top-level.cmake)
|
|
include(cmake/variables.cmake)
|
|
|
|
# ---- Declare library ----
|
|
|
|
find_package(ethercat REQUIRED)
|
|
link_libraries(ethercat)
|
|
|
|
add_library(
|
|
ec-controller_lib OBJECT
|
|
source/lib.cpp
|
|
)
|
|
|
|
target_include_directories(
|
|
ec-controller_lib ${warning_guard}
|
|
PUBLIC
|
|
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source>"
|
|
)
|
|
|
|
target_compile_features(ec-controller_lib PUBLIC cxx_std_20)
|
|
|
|
# ---- Declare executable ----
|
|
|
|
add_executable(ec-controller_exe source/main.cpp)
|
|
add_executable(ec-controller::exe ALIAS ec-controller_exe)
|
|
|
|
set_property(TARGET ec-controller_exe PROPERTY OUTPUT_NAME ec-controller)
|
|
|
|
target_compile_features(ec-controller_exe PRIVATE cxx_std_20)
|
|
|
|
target_link_libraries(ec-controller_exe PRIVATE ec-controller_lib)
|
|
|
|
# ---- Install rules ----
|
|
|
|
if(NOT CMAKE_SKIP_INSTALL_RULES)
|
|
include(cmake/install-rules.cmake)
|
|
endif()
|
|
|
|
# ---- Developer mode ----
|
|
|
|
if(NOT ec-controller_DEVELOPER_MODE)
|
|
return()
|
|
elseif(NOT PROJECT_IS_TOP_LEVEL)
|
|
message(
|
|
AUTHOR_WARNING
|
|
"Developer mode is intended for developers of ec-controller"
|
|
)
|
|
endif()
|
|
|
|
include(cmake/dev-mode.cmake)
|