Skip to content

Misc CMake build improvements - #608

Open
LeSpocky wants to merge 3 commits into
EIPStackGroup:masterfrom
LeSpocky:build
Open

Misc CMake build improvements#608
LeSpocky wants to merge 3 commits into
EIPStackGroup:masterfrom
LeSpocky:build

Conversation

@LeSpocky

@LeSpocky LeSpocky commented Sep 4, 2026

Copy link
Copy Markdown

When trying to package OpENer for a PTXdist based embedded Board Support Package (BSP), some issues with the CMake build came up. Commit message should explain in detail, but some additional notes on the patches here.

  1. For patch "build: Find buildsupport dir if CMAKE_FIND_ROOT_PATH is set" there's an alternative to using find_path() with a path inside the project. This would involve some more magic with the cmake modules for different platforms based on OpENer_PLATFORM, but in principle you could also do this, avoiding any find_path pitfalls:
# add the local path with cmake modules to cmake module search paths
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/buildsupport")
# include the custom cmake module like any other
include(OpENer)
  1. Instead of manually settings CMAKE_INSTALL_BINDIR you could just use the standard CMake module GNUInstallDirs, at least on Linux, where it sets all the install paths to reasonable defaults.

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 <ada@thorsis.com>
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: 46737eb ("Fix that if BINDIR is empty CMake does not fail")
Signed-off-by: Alexander Dahl <ada@thorsis.com>
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 <ada@thorsis.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant