@@ -7,8 +7,10 @@ set(CMAKE_CXX_STANDARD 17)
77set (CMAKE_CXX_STANDARD_REQUIRED ON )
88set (CMAKE_POSITION_INDEPENDENT_CODE ON )
99
10- include_directories (src/include
11- ${PROJECT_BINARY_DIR } /src/include/ )
10+ include_directories (
11+ src/include
12+ ${PROJECT_BINARY_DIR } /src/include/
13+ )
1214
1315include (cmake/version.cmake )
1416
@@ -23,16 +25,17 @@ set(SOURCES
2325
2426include (cmake/env.cmake )
2527
26-
2728set (VENDOR_SOURCES
2829 src/main/CanVendorAnagate.cpp
2930)
3031
3132if (UNIX )
33+ include (cmake/libsocketcan.cmake )
34+ include_directories (${LIBSOCKETCAN_INCLUDE_DIR} )
3235 list (APPEND VENDOR_SOURCES
33- src/main/CanVendorSocketCan.cpp
34- src/main/CanVendorSocketCanSystec.cpp
35- )
36+ src/main/CanVendorSocketCan.cpp
37+ src/main/CanVendorSocketCanSystec.cpp
38+ )
3639endif ()
3740
3841if (NOT DEFINED CAN_MODULE_MAIN_ONLY)
@@ -44,31 +47,36 @@ endif()
4447
4548include (cmake/anagate.cmake )
4649
50+
4751add_library (CanModuleMain ${SOURCES} ${VENDOR_SOURCES} )
48- target_include_directories (CanModuleMain PUBLIC ${LOGIT_INCLUDE} ${anagate_SOURCE_DIR } / )
52+
53+ target_include_directories (CanModuleMain PUBLIC
54+ ${LOGIT_INCLUDE}
55+ ${anagate_SOURCE_DIR } /
56+ )
57+
4958if (UNIX )
5059 target_link_libraries (CanModuleMain PUBLIC
51- ${anagate_SOURCE_DIR } /Linux64/CentOS_9/libCANDLLStaticRelease64.a
52- ${anagate_SOURCE_DIR } /Linux64/CentOS_9/libAnaGateStaticRelease.a
53- ${anagate_SOURCE_DIR } /Linux64/CentOS_9/libAnaGateExtStaticRelease.a
54- socketcan )
60+ ${anagate_SOURCE_DIR } /Linux64/CentOS_9/libCANDLLStaticRelease64.a
61+ ${anagate_SOURCE_DIR } /Linux64/CentOS_9/libAnaGateStaticRelease.a
62+ ${anagate_SOURCE_DIR } /Linux64/CentOS_9/libAnaGateExtStaticRelease.a
63+ libsocketcan
64+ )
5565else ()
5666 target_link_libraries (CanModuleMain PUBLIC
57- ${anagate_SOURCE_DIR } /Win64/AnaGateCanDll64.lib )
58- file (COPY "${anagate_SOURCE_DIR } /Win64/AnaGateCan64.dll" DESTINATION "${CMAKE_BINARY_DIR } /Release" )
67+ ${anagate_SOURCE_DIR } /Win64/AnaGateCanDll64.lib
68+ )
69+ file (COPY "${anagate_SOURCE_DIR } /Win64/AnaGateCan64.dll"
70+ DESTINATION "${CMAKE_BINARY_DIR } /Release" )
5971endif ()
6072
61- # Treat warnings as errors
6273if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" )
63- target_compile_options (CanModuleMain PRIVATE -Wall -Wextra -Werror )
74+ target_compile_options (CanModuleMain PRIVATE -Wall -Wextra -Werror )
6475elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
65- # target_compile_options(CanModuleMain PRIVATE /W4 /WX)
66- # I need to disable that feature due to a macro redefinition
67- # in the header of Anagate software
76+ # Disabled because of AnaGate macro redefinition issues
6877endif ()
6978
7079if (NOT DEFINED CAN_MODULE_MAIN_ONLY)
71- # Build Python Support and Google Unit Tests
7280 include (cmake/pybind11.cmake )
7381 include (cmake/gtest.cmake )
7482endif ()
0 commit comments