Skip to content

Install broken if CMAKE_BUILD_TYPE not specified #445

@mwoehlke-kitware

Description

@mwoehlke-kitware

Related: flexible-collision-library/fcl#656

If the user does not specify CMAKE_BUILD_TYPE, the build root thinks the configuration is (empty string). However, due to include(CompilerSettings) in octomap/CMakeLists.txt, the actual library thinks it is Release. This results in the install step trying to install the configuration (empty string), but no corresponding exports exist, resulting in a broken installation.

This can be verified by the absense of octomap-targets-*.cmake files in an installation. For example:

FROM ubuntu:noble AS base

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get -qq update && \
    apt-get -qq --yes install \
        libeigen3-dev \
        libccd-dev \
        git \
        g++ \
        cmake \
        ninja-build

FROM base AS octomap

RUN git clone https://github.com/OctoMap/octomap /octomap

RUN mkdir /octomap/build && \
    cmake \
        -DCMAKE_POLICY_VERSION_MINIMUM=3.10 \
        -G Ninja \
        -S /octomap \
        -B /octomap/build

RUN cd /octomap/build && ninja install

Removing include(CompilerSettings) seems to fix the problem; as expected, a octomap-targets-noconfig.cmake gets generated and installed. Alternatively, moving include(CompilerSettings) to the root CMakeLists.txt likely solves the issue as long as octomap is built stand-alone. If the latter approach is preferred, consider guarding the inclusion with if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) or something equivalent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions