From 3b0888c6bab5318fa7900c4fa32fcd37005ee377 Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Fri, 4 Sep 2026 08:26:33 +0200 Subject: [PATCH 1/3] build: Find buildsupport dir if CMAKE_FIND_ROOT_PATH is set In certain cross build environments CMAKE_FIND_ROOT_PATH is set globally for all CMake packages. For example in ptxdist CMAKE_FIND_ROOT_PATH is set to the cross-compiling sysroot and OpENer failed to find the buildsupport directory. Because PROJECT_SOURCE_DIR is an absolute path anyway, buildsupport dir is found now regardless if CMAKE_FIND_ROOT_PATH is set (cross-build) or not (usual build). Signed-off-by: Alexander Dahl --- source/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index be392c127..5c0c98c96 100755 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -36,7 +36,11 @@ configure_file( "${PROJECT_BINARY_DIR}/src/ports/devicedata.h" ) -find_path( OpENer_BUILDSUPPORT_DIR OpENer.cmake ${PROJECT_SOURCE_DIR}/buildsupport ) +find_path(OpENer_BUILDSUPPORT_DIR + NAMES OpENer.cmake + PATHS "${PROJECT_SOURCE_DIR}/buildsupport" + NO_CMAKE_FIND_ROOT_PATH +) INCLUDE( ${OpENer_BUILDSUPPORT_DIR}/OpENer.cmake ) From aa023fbe87cee3cf3e7ac443a23d995b52aa6063 Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Fri, 4 Sep 2026 08:35:00 +0200 Subject: [PATCH 2/3] posix: Install to relative bindir CMAKE_INSTALL_FULL_BINDIR is not set anywhere, it is sufficient to install to CMAKE_INSTALL_BINDIR which is usually set to just 'bin'. CMake recommends to NOT use absolute pathes with install. If not messing with CMAKE_INSTALL_PREFIX files end up in /usr/bin where one would expect it anyways. Fixes: 46737eb9e155 ("Fix that if BINDIR is empty CMake does not fail") Signed-off-by: Alexander Dahl --- source/src/ports/POSIX/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/src/ports/POSIX/CMakeLists.txt b/source/src/ports/POSIX/CMakeLists.txt index b0b0dd852..2edf69a23 100755 --- a/source/src/ports/POSIX/CMakeLists.txt +++ b/source/src/ports/POSIX/CMakeLists.txt @@ -66,5 +66,5 @@ if( NOT OpENer_TESTS) endif() if(NOT ${CMAKE_INSTALL_BINDIR} STREQUAL "") - install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/OpENer DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) + install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/OpENer DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() From 3b9f2bbfbb9c9707f29912e5375a9c99ad6ad3ac Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Fri, 4 Sep 2026 08:39:08 +0200 Subject: [PATCH 3/3] posix: Install the sample_app library The OpENer executable is linked against SAMPLE_APP so that library must be installed, otherwise the installed OpENer binary won't find all required libraries and refuses to start. Signed-off-by: Alexander Dahl --- source/src/ports/POSIX/sample_application/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/src/ports/POSIX/sample_application/CMakeLists.txt b/source/src/ports/POSIX/sample_application/CMakeLists.txt index 96479bc76..a971ee8c1 100644 --- a/source/src/ports/POSIX/sample_application/CMakeLists.txt +++ b/source/src/ports/POSIX/sample_application/CMakeLists.txt @@ -15,3 +15,9 @@ endif() add_library(SAMPLE_APP sampleapplication.c ${SAMPLE_APP_DLR_ONLY_SRC}) target_link_libraries( SAMPLE_APP NVDATA ) +if( OPENER_INSTALL_AS_LIB ) + install(TARGETS SAMPLE_APP + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) +endif()