Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A cmake initial cache file via '-C' with --cmake-args fails #104

Open
stonier opened this issue May 14, 2021 · 3 comments
Open

A cmake initial cache file via '-C' with --cmake-args fails #104

stonier opened this issue May 14, 2021 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@stonier
Copy link

stonier commented May 14, 2021

$ colcon  build --symlink-install --event-handlers console_direct+ --cmake-args -C /mnt/mervin/workspaces/devel/camera/initial_cache.cmake
loading initial cache file /mnt/mervin/workspaces/devel/camera/initial_cache.cmake
Re-run cmake no build system arguments
CMake Error: The source directory "/mnt/mervin/workspaces/devel/camera/initial_cache.cmake" is a file, not a directory.

So, loads fine, but fails because it confuses the initial cache path with the source directory. Digging into an example of the actual command that colcon uses for cmake (use --log-level=debug with colcon):

[0.214s] DEBUG:colcon.colcon_core.event_handler.log_command:Invoked command in '/mnt/mervin/workspaces/devel/camera/build/ueye_cam' returned '1':  CMAKE_PREFIX_PATH=/opt/ros/dashing /usr/bin/cmake /mnt/mervin/workspaces/devel/camera/src/ueye_cam -C /mnt/mervin/workspaces/devel/camera/initial_cache.cmake -DAMENT_CMAKE_SYMLINK_INSTALL=1 -DCMAKE_INSTALL_PREFIX=/mnt/mervin/workspaces/devel/camera/install/ueye_cam

Here the source directory is specified prior to the -C argument (as well as the other arguments). While this works for other cmake args, it does not work for the -C argument. In addition, this would appear not to be a cmake problem - cmake does in fact suggest options should come first:

cmake --help
Usage

  cmake [options] <path-to-source>
  cmake [options] <path-to-existing-build>

Q: Are there any ramifications to moving the specified source directory to the end of this list of arguments?

@stonier
Copy link
Author

stonier commented May 14, 2021

Attempting to switch the order (i.e. put args.path to the end) in:

cmake_args = [args.path]
cmake_args += (args.cmake_args or [])
cmake_args += ['-DCMAKE_INSTALL_PREFIX=' + args.install_base]

@stonier stonier changed the title Attempting to use a cmake initial cache file via '-C' with --cmake-args fails A cmake initial cache file via '-C' with --cmake-args fails May 14, 2021
@hidmic hidmic added bug Something isn't working help wanted Extra attention is needed labels Sep 10, 2021
@hidmic
Copy link
Contributor

hidmic commented Sep 10, 2021

Q: Are there any ramifications to moving the specified source directory to the end of this list of arguments?

This makes sense to me. @dirk-thomas ?

@stonier would you be willing to submit a patch?

@dirk-thomas
Copy link
Member

Sounds reasonable to me. I haven't tried or tested the suggestion though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Development

No branches or pull requests

3 participants