[question] LIB_DIRS variables in V1 have build type suffix (LIB_DIRS_RELEASE) in V2?
See original GitHub issueThis could be something very easy that I have overlooked. I wrote a simple conanfile.py using conans.ConanFile
and conans.CMake
as well as the generator cmake_find_package
. My CMakeLists.txt
had lines like this referencing other Conan packages in my requires
:
find_package(foo REQUIRED)
include_directories(${foo_INCLUDE_DIRS})
link_directories(${foo_LIB_DIRS})
I use conan create
. Upon converting this recipe to Conan V2 format using conan.ConanFile
and conan.tools.cmake.CMake
as well as the generators conan.tools.cmake.CMakeToolchain
and conan.tools.cmake.CMakeDeps
, I started getting linker errors that only went away when I updated my link_directories
commands after realizing that the LIB_DIRS
variables no longer existed but LIB_DIRS_RELEASE
variables were there instead.
Although both versions of the recipe run CMake with CMAKE_BUILD_TYPE=Release
, the suffix is only there when building from the V2 recipe. Is this difference documented anywhere?
Interestingly, for gtest I also had to change include_directories(${GTest_INCLUDE_DIRS})
to include_directories(${gtest_INCLUDE_DIRS_RELEASE})
. Not only did the case change but the _RELEASE
suffix is needed here whereas on my other dependencies it is only on LIB_DIRS
. Is this behavior recipe-specific?
Conan 1.55.0
- I’ve read the CONTRIBUTING guide.
Issue Analytics
- State:
- Created 9 months ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Perfect, I am very happy that it worked! 😃
Yes, that is the idea of “modern CMake”, that is all about targets. Not needing to worry about individual properties like includedirs, libdirs, but the target includes all the related information for that specific library, including its includedirs.
I’m not very experienced with CMake, but doing that worked, thanks!