aboutsummaryrefslogtreecommitdiffstats
path: root/conf.d/cmake
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-06-26 09:14:42 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2019-06-26 17:55:05 +0200
commit82b45e3de8c92816c8080178224c5bd4be60a091 (patch)
tree13da4bf66579ae174ecdb2f3f85f8bd248a927ef /conf.d/cmake
parent9f0d5da859bfe7778394f35baf48fbe77f1ed7d9 (diff)
Add CMake option to compile with J1939
Add option USE_FEATURE_J1939 to compile j1939 in file config.cmake This will be set up by default depending on the presence on the building host of the J1939 CAN module headers. Bug-AGL: SPEC-2386 Change-Id: I54d4594ff01d4e509bfa0862f3cb486562024aed Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'conf.d/cmake')
-rw-r--r--conf.d/cmake/config.cmake15
1 files changed, 15 insertions, 0 deletions
diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake
index 9e9a15b0..e6da31a0 100644
--- a/conf.d/cmake/config.cmake
+++ b/conf.d/cmake/config.cmake
@@ -40,6 +40,21 @@ set(PROJECT_CMAKE_CONF_DIR "conf.d")
# ----------------------------------
set(BUILD_TYPE "RELEASE" CACHE STRING "Default Build variant chosen. (Overwritten by cli if given)")
+# Activate J1939
+# Need module in kernel
+# --------------
+
+execute_process(COMMAND ls /usr/include/linux/can/j1939.h RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET)
+
+if(result)
+ message("Feature J1939 disabled")
+ set(WITH_FEATURE_J1939 OFF)
+else()
+ message("Feature J1939 enabled")
+ set(WITH_FEATURE_J1939 ON)
+ add_definitions(-DUSE_FEATURE_J1939)
+endif()
+
# Kernel selection if needed. You can choose between a
# mandatory version to impose a minimal version.
# Or check Kernel minimal version and just print a Warning