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

cmake --find-package ... -DNAME=drake does not work? #13797

Closed
EricCousineau-TRI opened this issue Aug 3, 2020 · 7 comments
Closed

cmake --find-package ... -DNAME=drake does not work? #13797

EricCousineau-TRI opened this issue Aug 3, 2020 · 7 comments
Labels
component: build system Bazel, CMake, dependencies, memory checkers, linters priority: low unused team: kitware

Comments

@EricCousineau-TRI
Copy link
Contributor

EricCousineau-TRI commented Aug 3, 2020

When trying out different solutions for #7889, I wanted to see if I could get the include paths + flags for Drake "for free" using CMake in pkg-config mode:

# Downloaded and unpackaged a nightly here.
$ cat ./share/doc/drake/VERSION.TXT
20200729064618 2daabfac1b81f9165d8fece7891df03bb67e8e72
$ cmake --version
cmake version 3.10.2
$ cmake --find-package -DCMAKE_PREFIX_PATH=${PWD} -DNAME=drake -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=COMPILE
CMake Error in lib/cmake/drake/drake-config.cmake:
  cmake_policy PUSH without matching POP
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/CMakeFindPackageMode.cmake:180 (find_package)

drake not found.
CMake Error: Problem processing arguments. Aborting.

FTR, there is a corresponding POP in the cps-generated drake-config.cmake file:
https://gist.github.com/EricCousineau-TRI/2567b4077d40cb2c85767d9981d078a8

FYI @jwnimmer-tri

@EricCousineau-TRI
Copy link
Contributor Author

Tried with a later version of CMake, same result:

$ fhs-extend ~/.local/opt/cmake-3.18.0-rc4-Linux-x86_64/
$ cmake --version
cmake version 3.18.0-rc4
$ cmake --find-package -DCMAKE_PREFIX_PATH=${PWD} -DNAME=drake -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=COMPILE
CMake Error in lib/cmake/drake/drake-config.cmake:
  cmake_policy PUSH without matching POP
Call Stack (most recent call first):
  /home/eacousineau/.local/opt/cmake-3.18.0-rc4-Linux-x86_64/share/cmake-3.18/Modules/CMakeFindPackageMode.cmake:183 (find_package)

@EricCousineau-TRI
Copy link
Contributor Author

EricCousineau-TRI commented Aug 3, 2020

This failure mode doesn't seem relevant, but perhaps pycps can have an option to not put in cmake_policy()?
https://gitlab.kitware.com/cmake/cmake/-/issues/17612

EDIT: Actually, removing the cmake_policy bits does nothing.

So something else is broken, but it's unclear what.
FTR, I am able to configure drake-cmake-installed with that setup.

@jamiesnape
Copy link
Contributor

cmake --find-package has probably always been broken, as it is on most CMake projects: https://cmake.org/cmake/help/latest/manual/cmake.1.html#run-the-find-package-tool. Not something we will fix.

@EricCousineau-TRI
Copy link
Contributor Author

EricCousineau-TRI commented Aug 3, 2020

That's kinda buried. If it's not well supported, I think y'all should hoist that message even higher.

For example, on this semi-bleeding edge cmake version:

$ cmake --version
cmake version 3.18.0-rc4
$ cmake --help | grep '\--find-package' -C 1
  -P <file>                    = Process script mode.
  --find-package               = Run in pkg-config like mode.
  --graphviz=[file]            = Generate graphviz of dependencies, see

IMO, it should read:

  --find-package               = (UNSUPPORTED) Run in pkg-config like mode. Please avoid using this.

Can you please file the appropriate upstream issue, and then post it here and re-close this issue once you've done that?

@jamiesnape
Copy link
Contributor

You are welcome to file the issue, but I think it is fine.

@jwnimmer-tri
Copy link
Collaborator

This is not a Drake-specific issue, so I don't see any need to keep this ticket open on the component: build system dashboard, or spend Drake's dime on it.

@EricCousineau-TRI
Copy link
Contributor Author

@jamiesnape jamiesnape removed their assignment Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: build system Bazel, CMake, dependencies, memory checkers, linters priority: low unused team: kitware
Projects
None yet
Development

No branches or pull requests

3 participants