-
Notifications
You must be signed in to change notification settings - Fork 999
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
[CMakeToolchain][env] Added PKG_CONFIG_PATH env variable and PKG_CONFIG_EXECUTABLE one #12513
[CMakeToolchain][env] Added PKG_CONFIG_PATH env variable and PKG_CONFIG_EXECUTABLE one #12513
Conversation
8ea1999
to
021ae22
Compare
user_pkg_config_path = os.getenv("PKG_CONFIG_PATH") | ||
if user_pkg_config_path: | ||
# Prepending the Conan one | ||
pkg_config_path = pkg_config_path + os.pathsep + user_pkg_config_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I use this approach from EnvVars
?
self._subsystem = deduce_subsystem(conanfile, scope)
@property
def _pathsep(self):
return ":" if self._subsystem != WINDOWS else ";"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think the correct way to do this is to deduce the subsystem and then aplying the path separator according to that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question is: should I assume that scope == "build"
? Here, we don't have any scope defined.
@pytest.mark.tool_pkg_config | ||
def test_cmaketoolchain_and_pkg_config_path(): | ||
""" | ||
Lightweight test which is loading a dependency as a *.pc file through |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job with this test!
# hardcoding scope as "build" | ||
subsystem = deduce_subsystem(self._conanfile, "build") | ||
pathsep = ":" if subsystem != WINDOWS else ";" | ||
pkg_config_path = pkg_config_path.replace("\\", "/") + pathsep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this! :D Matches the documentation - and still allows (a few lines above in the template block) to fall back on anything the user may have previously specified
PKG_CONFIG_PATH
A colon-separated (on Windows, semicolon-separated) list of directories to search for .pc files. The default directory will always be searched after searching the path; the default is libdir/pkgconfig:datadir/pkgconfig where libdir is the libdir where pkg-config and datadir is the datadir where pkg-config was installed.
I'm running conan version 1.60.1 and I'm seeing
Also, if I set pkg_config with the conan config command, it corrupts
It only seems to work if I put a |
Hi @hoyhoy This is a closed issue from 8 months ago, it would be better to report this as a new ticket. Also |
Hmmm, |
No, you are mixing things. In Conan 1.X the two different confs coexist:
|
Changelog: Feature: Added generators folder to
PKG_CONFIG_PATH
environment variable inCMakeToolchain
.Changelog: Feature: Ensure that
CMakeToolchain
will enforce usage ofpkg-config
executable set intools.gnu:pkg_config
config.Closes: #11962
Partial implementation of #12354
Docs: conan-io/docs#2832
Note: Originally started by #12355