CMake Error at CMakeLists.txt:96 (install): install TARGETS given unknown argument "NAMELINK_COMPONENT" - cmake

I am writing a CMakeLists.txt to compile and install my programs. I have following error with the below install() command. I need to install a symbolic link (additionally to the library so file) for the created library.
CMake Error at CMakeLists.txt:96 (install): install TARGETS given
unknown argument "NAMELINK_COMPONENT".
install(TARGETS my-library
LIBRARY
DESTINATION /usr/lib/
COMPONENT Libraries
NAMELINK_COMPONENT Development
)
I am following the instructions given in the CMake documentation (https://cmake.org/cmake/help/v3.13/command/install.html#). is this because of cmake version in my PC or syntax error ?
please help.

You need to have same version of CMake (v3.13) or newer.

Related

Use CMake binares to build cpp projects without installing CMake

I want to use specific version of CMake 3.19.0 for Ubuntu 14.04 (32-bits) without installing CMake (use only binaries).
I tried to build CMake 3.19.0 on my test machine. It builded and installed successfully. In install_manifest.txt I see lot of files that were installed on my test system.
So, I tried to copy only installed binaries from /usr/local/bin/ (this is default path where CMake binaries were installed) and paste it to another machine that doesn't know about CMake. I paste 3 binaries: cmake, ctest, cpack to /usr/local/bin/.
If I run which cmake it shows path:
/usr/local/bin/cmake
If I run cmake --verison it shows:
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/share/cmake-3.19
cmake version 3.19.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
It looks like CMake needs some modules that I haven't copied yet. I tried to build my cpp project and it shows me:
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/share/cmake-3.19
CMake Error: Error executing cmake::LoadCache(). Aborting.
What are the minimum required modules needed for stable building? And where I should copy it?
Just copied builded Modules and Templates directories from cmake-3.19.0 build directory to /usr/local/share/cmake-3.19

cmake version in catkin_make different from global cmake version?

I'm trying to build some package in ROS using catkin.
When I run catkin_make in the top level directory, I got complaint about cmake version:
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/ignition-math4/ignition-math4-config.cmake:26 (cmake_minimum_required):
CMake 3.5.1 or higher is required. You are running version 3.3.2
Then I updated my cmake version, and also modified the path. I verified that the version of cmake is now 3.15:
~/catkin_ws$ cmake --version
cmake version 3.15.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
when I go back and try catkin_make again, the problem still remains.
I suppose that catkin has defined its own path or environment variable somewhere and are using cmake from a different place, but I couldn't figure out how to change it. Any suggestions? Thanks in advance.
--Kevin
you could remove .catkin_tools from your working directory, and redo the initialization of catkin:
source /opt/ros/<your-ros-development>/setup.bash
and
catkin init
if your environment setup is correct, that should do the trick.

CMake find_package not working for Eigen?

I'm currently developing a Kalman Filtering library using Eigen and I've successfully gotten it working on my development Mac. Now I'm trying to set it up with Travis CI and CMake is having trouble with finding the package. First I sudo apt install libeigen3-dev and then attempt to run cmake with the following configuration:
cmake_minimum_required(VERSION 3.0)
project(KFilter VERSION 0.1.0)
find_package (Eigen3 REQUIRED NO_MODULE)
add_library(KFilter KFilter.cpp)
target_link_libraries(KFilter Eigen3::Eigen)
This builds just fine on my Mac, but in Travis CI it errors out with the following:
CMake Error at CMakeLists.txt:5 (add_library):
Target "KFilter" links to target "Eigen3::Eigen" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
Why is would I be getting this error at line 5 when the find_package seems to be successful? I'm following this guide from the Eigen website.
Travis CI is running Ubuntu 16.04 with CMake 3.12 and the Eigen3 debian package, while my Mac is running CMake 3.13 with Eigen installed through homebrew. I'm really confused as to why CMake is behaving differently.
You don't mention which version of Eigen3 is being used in each case.
It looks like between Eigen3 3.2 and 3.3 it changed from using FindEigen3.cmake to Eigen3Config.cmake. This changed how to include Eigen3 into a project and in 3.3 it uses Eigen3::Eigen3.
But as it turns out on Ubuntu 16.04 the package is libeigen3-dev (3.3~beta1-2) and 3.3 beta versions didn't export Eigen3::Eigen3 instead it contains:
add_definitions ( ${EIGEN3_DEFINITIONS} )
include_directories ( ${EIGEN3_INCLUDE_DIRS} )
So just remove target_link_libraries(KFilter Eigen3::Eigen) and it should be fine.
What worked for me using Ubuntu 16.04 was to remove the target_link_libraries(KFilter Eigen3::Eigen) and change in my source file the following line #include <eigen3/Eigen/Dense>

pip3 gives CMake Error in CMakeLists.txt

I am trying to run pip3 install face_recognition. But it gives below problem for cmake.
Building for: NMake Makefiles
CMake Error in CMakeLists.txt:
Generator
NMake Makefiles
does not support platform specification, but platform
x64
was specified.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
pip3 version is 9.03, Python 3.7 and cmake 3.12.0-rc3. I don't have Visual studio. I don't have admin rights on my PC. Hence I downloaded the all the above packages, extracted and added their bin dir in path. Similar way I have installed MinGW and added its bin directory in path. Nothing is working. Couple of forums talk about removing CMakeCache.txt. I am struggling to find CMakeCache.txt. I think pip command is downloading the package, extracting in temp directory and compiling it. When compilation fails it delete the extracted content. Not sure. Please help
After carefully studying a logs, I realized it's Dlib installation a giving problem. After lots of search, I got the url https://www.learnopencv.com/install-opencv-3-and-dlib-on-windows-python-only. It suggest to use Anaconda. I installed the Anaconda and followed the instruction from article and discussions. It worked perfectly for me.

Could not find CMake package configuration file for "Eigen3"

When I enter this command:
cd /Users/mona/ros_catkin_ws/build_isolated/pcl_ros && /Users/mona/ros_catkin_ws/install_isolated/env.sh cmake /Users/mona/ros_catkin_ws/src/perception_pcl/pcl_ros -DCATKIN_DEVEL_PREFIX=/Users/mona/ros_catkin_ws/devel_isolated/pcl_ros -DCMAKE_INSTALL_PREFIX=/Users/mona/ros_catkin_ws/install_isolated -DCMAKE_BUILD_TYPE=Release -G 'Unix Makefiles'
I receive this error:
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- system
-- filesystem
-- thread
CMake Error at CMakeLists.txt:7 (find_package):
By not providing "FindEigen3.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Eigen3", but
CMake did not find one.
Could not find a package configuration file provided by "Eigen3" with any
of the following names:
Eigen3Config.cmake
eigen3-config.cmake
Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set
"Eigen3_DIR" to a directory containing one of the above files. If "Eigen3"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
See also "/Users/mona/ros_catkin_ws/build_isolated/pcl_ros/CMakeFiles/CMakeOutput.log".
This command is ran as part of running this command for installing ROS:
./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release
Any idea how that could be fixed?
Please see more details of question here: http://answers.ros.org/question/215080/how-to-add-the-installation-prefix-of-eigen3-to-cmake_prefix_path-or-set-eigen3_dir-to-a-directory-containing-one-of-the-above-files/
For linux users, this may help like it did for me: just install the developers' package of the eigen3 lib by the following command.
sudo apt install libeigen3-dev
You have to install Eigen3. It provides the FindEigen3.cmake file. The error occurs because the project you want to configure, has a dependency to Eigen3.
If you have Eigen3 installed, follow the error message and add Eigen3 to CMake's search path.