cmake_min_version icon indicating copy to clipboard operation
cmake_min_version copied to clipboard

find_package prevent usage of this tools ?

Open mwestphal opened this issue 2 years ago • 4 comments

On a project with find_package, this tool provides:

[glow@arch ~/tmp/cmake_min_version]$ python cmake_min_version.py ~/dev/f3d/f3d/src/examples/
Found 25 CMake binaries from directory tools

[  0%] CMake 3.13.5 ✘ error
       CMakeLists.txt:5 (find_package)
[ 17%] CMake 3.19.8 ✘ error
       CMakeLists.txt:5 (find_package)
[ 33%] CMake 3.22.6 ✘ error
       CMakeLists.txt:5 (find_package)
[ 50%] CMake 3.24.3 ✘ error
       CMakeLists.txt:5 (find_package)
[ 80%] CMake 3.25.2 ✘ error
       CMakeLists.txt:5 (find_package)
[100%] ERROR: Could not find working version.

Not sure if this is an issue or a limitation.

mwestphal avatar Jan 24 '23 07:01 mwestphal

It's not designed not to work, so this is a bug. Do you have any example project that exhibits this bug? Which OS are you using?

nlohmann avatar Jan 27 '23 21:01 nlohmann

I've been try to use it an any simple project like this one:

project(check-engine)

cmake_minimum_required(VERSION 3.1)

find_package(f3d REQUIRED)

add_executable(check-engine main.cxx)
target_link_libraries(check-engine f3d::libf3d)

# make sure the libf3d API is compatible with C++11
set_target_properties(check-engine PROPERTIES CXX_STANDARD 11)

it fails on find_package

mwestphal avatar Feb 02 '23 07:02 mwestphal

It might not be the same problem as @mwestphal, but I encountered something similar with FindPkgConfig.cmake when trying to use cmake_min_version. In my case some packages were not installed in default system locations and explicitly setting the CMAKE_PREFIX_PATH environment variable fixed the problem for me:

CMAKE_PREFIX_PATH=~/projects/foobar/prefix venv/bin/python cmake_min_version.py ~/projects/foobar/repo

Even though this worked for my case, it would be nice to be able to control what gets passed to the underlying CMakes explicitly with a script option or similar.

alberto-miranda avatar Feb 03 '23 13:02 alberto-miranda

Even though this worked for my case, it would be nice to be able to control what gets passed to the underlying CMakes explicitly with a script option or similar.

Do you mean command-line options or environment variables?

nlohmann avatar Apr 02 '24 15:04 nlohmann