Error libtool: command not found
Solve it by sudo apt install libtool-bin
StackExchange: libtool installed but not found in /usr/bin
Error libtool: command not found
Solve it by sudo apt install libtool-bin
StackExchange: libtool installed but not found in /usr/bin
In Ubuntu 18.04
, I have trouble configuring CMake for my code, due to the requirement of Filesystem
.
Despite FindFilesystem.cmake
in in CMAKE_MODULE_PATH
, the compiler still keep complaining it is not found.
To be able to configure cmake successfully, I need to run cmake as follows
env CXX=clang++-10 cmake ..
Under freshly installed ubuntu, you might attempted to update to the latest CMake(it is recommended anyway). Thus you need to install it from source.
You might faced these issue
Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x
The solution to this is to install qt4-default
.
sudo apt install qt4-default
Stackoverflow: CMake doesn't know where is Qt4 qmake
By default, Ubuntu 20.04 doesn't have qt4 anymore in the main repository
. You need to download it from PPA.
sudo add-apt-repository ppa:rock-core/qt4
sudo apt-get update
Stackoverflow: Cannot install Qt-4 on Ubuntu 20.04
So you run cmake and set the install prefix to somewhere rural in your pc. By default, when you trying to search the package via find_package
, chances are cmake wont be able to find it.
Obviously you need to tell cmake where it needs to look (Though this might not be the best solution out there). So how to tell them that? For this example, Package A depends on Filesystem (Findfilesystem.cmake) will take care of them.
There is two things you need to append, CMAKE_PREFIX_PATH
and CMAKE_MODULE_PATH
. Assuming that your trying to run find_package(B)
, and your directory looks like this
install
├── include
│ └── A
└── lib
├── cmake
│ └── A
│ ├── FindFilesystem.cmake
│ ├── A-config.cmake
│ ├── ATargets.cmake
│ └── ATargets-noconfig.cmake
├── libA.a
└── A
└── libC.a
Your CMakeLists.txt
needs to have these
list(APPEND CMAKE_PREFIX_PATH "/path/to/where/A/is/install/") # to point to A
list(APPEND CMAKE_MODULE_PATH "/path/to/where/A/is/install/lib/cmake/A") # to point to FindFilesystem.cmake
find_package(Filesystem)
find_package(A)
Personally, I think there might be a better way to do this, but to my current knowledge, this is what I do for now.