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

"Pre-populate CMake cache" file path doesn't expand eclipse variables #152

Open
sliwowitz opened this issue May 6, 2021 · 2 comments
Open

Comments

@sliwowitz
Copy link

Describe the bug
The "File" input box in CMake Bulid properties will not expand eclipse variables such as ${workspace_loc}, and passes the ${workspace_loc} (or whatever) verbatim to "cmake -C" instead.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Properties -> C/C++ Build -> Cmake4eclipse
  2. Go to File under Pre-populate CMake cache entries from file (-C)
  3. Fill in a location with an eclipse variable, e.g. "${workspace_loc}/tools/CMakePrePopulate.txt"
  4. See the string is passed verbatim cmake -C ${workspace_loc}/tools/CMakePrePopulate.txt
  5. CMake interprets that as a path relative to the build directory, i.e. you get something like CMake Error: Error processing file: /home/username/prog/workspace/project_name/build/Release/${workspace_loc}/tools/CMakePrePopulate.txt

Expected behavior
Eclipse variables are expanded, resulting in cmake -C /home/username/prog/workspace/tools/CMakePrePopulate.txt in the example here.

Useful Information

  • cmake4eclipse version: 2.1.4.202103291945
  • Which OS do you use: Fedora 34
  • Cmake version: 3.19.7
@15knots 15knots added the bug label May 6, 2021
@15knots 15knots added enhancement and removed bug labels Jun 2, 2021
@15knots
Copy link
Owner

15knots commented Jun 2, 2021

It is by intent that variables are not allowed to pre-populate the cache. IMHO, the file to pre-populate the cache should be sitting inside the project source directory or users should put a PreLoad.cmake file into the source dir.
What exactly are you trying to achieve?

@sliwowitz
Copy link
Author

Honestly, I don't remember what was the exact thing I wanted to do. Basically in need to frequently switch build profiles to try out different combinations of CMake flags. For most of my current work projects, there's a base set of cca six CMake flags that are always the same on my machine, then there are other three or four which I want to test in different combinations. I guess I wanted to put those six in a separate file, since they're the same for all the projects (coming from our core library), and have them live inside my workspace, but outside the project directory (since they are specific to my machine).

In my case, an absolute path will do. It just felt inconsistent - when most other file entry dialogs expand the eclipse variables, I would have expected this dialog to expand them as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants