I have no idea how CMAKE_MODULE_PATH, CMAKE_PREFIX_PATH work,
It seems not add to search list for find_package()
- I already have such .cmake in system. and add path to CMakeFiles.txt
/opt/ros/humble/share/ament_cmake_python/cmake/ament_cmake_pythonConfig.cmake
- CMakeFiles.txt
cat CMakeFiles.txt
cmake_minimum_required(VERSION 3.22)
project(ProjectName)
list(APPEND CMAKE_MODULE_PATH "/opt/ros/humble/")
list(APPEND CMAKE_PREFIX_PATH "/opt/ros/humble/")
message(STATUS "CMAKE_MODULE_PATH is set to ${CMAKE_MODULE_PATH}")
find_package(ament_cmake_python REQUIRED)
add_executable(MyExecutable main.c)
(3) But get follow in error.
CMake Error at CMakeLists.txt:8 (find_package):
By not providing "Findament_cmake_python.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"ament_cmake_python", but CMake did not find one.
Could not find a package configuration file provided by
"ament_cmake_python" with any of the following names:
ament_cmake_pythonConfig.cmake
ament_cmake_python-config.cmake
Add the installation prefix of "ament_cmake_python" to CMAKE_PREFIX_PATH or