[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.
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.
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.
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 |
| # 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.
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_PATHenvironment variable inCMakeToolchain.Changelog: Feature: Ensure that
CMakeToolchainwill enforce usage ofpkg-configexecutable set intools.gnu:pkg_configconfig.Closes: #11962
Partial implementation of #12354
Docs: conan-io/docs#2832
Note: Originally started by #12355