Set Wno-dev in particular CMakeLists - linux

I have a project when I use cmake. I also use cmake to create a deb and an rpm package.
When building RPM we have many warnings like this:
CMake Warning (dev) at /usr/share/cmake-3.13/Modules/Internal/CPack/CPackRPM.cmake:135 (message):
CPackRPM:Warning: Path /etc/apache2/sites-available/mux.conf is not on one
of the relocatable paths! Package will be partially relocatable.
Call Stack (most recent call first):
/usr/share/cmake-3.13/Modules/Internal/CPack/CPackRPM.cmake:1001 (cpack_rpm_prepare_relocation_paths)
/usr/share/cmake-3.13/Modules/Internal/CPack/CPackRPM.cmake:1870 (cpack_rpm_generate_package)
This warning is for project developers. Use -Wno-dev to suppress it.
We have many sub CmakeLists files and even when we use "-Wno-dev" at the top of the project we still have this warning.
How can I force the Wno-dev in the CMakeLists that cause this warning?

Cmake-gui: Options|Warning Messages: Suppress Warnings - check "Developer Warnings"
From man cmake: cmake -Wno-dev ...

Related

set(SFML_STATIC_LIBRARIES TRUE) doesn't work in cmake with SFML 2.5.1 on Debian 10 Buster

I installed SFML with the command "apt install libsfml-dev".
I can link it in cmake discribed like in this post "https://en.sfml-dev.org/forums/index.php?topic=24070.0" and everything works pretty fine.
But if I add set(SFML_STATIC_LIBRARIES TRUE) to my cmake file to link sfml static I get the following error:
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/SFML/SFMLConfig.cmake:139 (message):
Requested SFML configuration (Static) was not found
Call Stack (most recent call first):
CMakeLists.txt:30 (find_package)
CMake Error at CMakeLists.txt:30 (find_package):
Found package configuration file:
/usr/lib/x86_64-linux-gnu/cmake/SFML/SFMLConfig.cmake
but it set SFML_FOUND to FALSE so package "SFML" is considered to be NOT
FOUND.
I recognized that the SFMLConfig.cmake file wants to access a SFMLStaticTargets.cmake file in line 110, if I set(SFML_STATIC_LIBRARIES TRUE).
But my /usr/lib/x86_64-linux-gnu/cmake/SFML folder just contains the following files for Shared linking:
SFMLConfig.cmake
SFMLConfigDependencies.cmake
SFMLConfigVersion.cmake
SFMLSharedTargets.cmake
SFMLSharedTargets-none.cmake
In sfml version I can download here "https://www.sfml-dev.org/download/sfml/2.5.1/" I can also just find these files in the lib/cmake/SFML folder, but a SFMLSharedTargets-release.cmake file instead of SFMLSharedTargets-none.cmake.
What can I do to static link sfml 2.5.1 in cmake?
The error you got comes from SFMLConfigDependencies.cmake, more specifically the last few lines.
The sfml_bind_dependency macro searches your system for libXXX.so, where XXX is one of the SEARCH_NAMES.
I think it suffices to install the -dev packages of the missing dependencies as follows:
apt install libjpeg-dev libfreetype6-dev libxcb-image0-dev
I got the answer in the sfml Forum!
You have to recompile SFML, because pre-built packages for Linux don't
contain static libraries.
https://en.sfml-dev.org/forums/index.php?topic=26837

Using Protobuf installed at a custom location in Linux with CMake?

I am packaging all my dependencies with Conan IO for a C++ project using CMake. I downloaded the sources of Protobuf and built them. I then added them on Conan.
On a build server, I am trying to build my CMake project, but it cannot seem to find my Protobuf library properly. Here's the log I am getting:
/home/user/Documents/project/test/build/venv/.conan/data/Protobuf/3.6.1/org/dev/package/80043e232e8ab07f4b25e67652a9490d9ad33d91/bin/protoc: error while loading shared libraries: libprotoc.so.17: cannot open shared object file: No such file or directory
CMake Warning at /home/username/Documents/project/test/build/venv/lib/python3.6/site-packages/cmake/data/share/cmake-3.10/Modules/FindProtobuf.cmake:455 (message):
Protobuf compiler version doesn't match library version 3.6.1
Call Stack (most recent call first):
/home/username/Documents/project/test/script/cmake/Env.cmake:139 (include)
CMakeLists.txt:6 (include)
-- Found Protobuf: /home/username/Documents/project/test/build/venv/.conan/data/Protobuf/3.6.1/org/dev/package/80043e232e8ab07f4b25e67652a9490d9ad33d91/lib/libprotobuf.so;-lpthread (found version "3.6.1")
/home/username/Documents/project/test/build/venv/.conan/data/Protobuf/3.6.1/org/dev/package/80043e232e8ab07f4b25e67652a9490d9ad33d91/bin/protoc: error while loading shared libraries: libprotoc.so.17: cannot open shared object file: No such file or directory
CMake Warning at /home/username/Documents/project/test/build/venv/lib/python3.6/site-packages/cmake/data/share/cmake-3.10/Modules/FindProtobuf.cmake:455 (message):
Protobuf compiler version doesn't match library version 3.6.1
Call Stack (most recent call first):
/home/username/Documents/project/test/src/shared/bysp/CMakeLists.txt:9 (find_package)
-- Found Protobuf: /home/username/Documents/project/test/build/venv/.conan/data/Protobuf/3.6.1/org/dev/package/80043e232e8ab07f4b25e67652a9490d9ad33d91/lib/libprotobuf.so;-lpthread;-lpthread (found version "3.6.1")
I'm having a hard time understanding what the problem is. It says it cannot find libprotoc.so.17, but that file exists under /lib in my conan package. It then says that it did find my library. I don't understand why it's giving me a warning and then says that it found the library. Also, protobuf is not installed on the build server. All dependencies are pre-built binaries downloaded via Conan. I am using FindProtobuf to find protobuf. Should I use something else?

HHVM CMake error

I am trying to install HHVM on an Ubunut 14.04 machine using this guide:
https://docs.hhvm.com/hhvm/installation/building-from-source#ubuntu-15.04-vivid
However, when running the cmake -DMYSQL_UNIX_SOCK_ADDR=/var/run/mysqld/mysqld.sock . step i am retuned an error like this:
CMake Error in third-party/CMakeLists.txt:
Cannot find source file:
INTERFACE
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
CMake Warning (dev) in third-party/CMakeLists.txt:
Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
interface. Run "cmake --help-policy CMP0022" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
Target "boost" has an INTERFACE_LINK_LIBRARIES property. This should be
preferred as the source of the link interface for this library but because
CMP0022 is not set CMake is ignoring the property and using the link
implementation as the link interface instead.
INTERFACE_LINK_LIBRARIES:
/usr/lib/x86_64-linux-gnu/libboost_context.so;/usr/lib/x86_64-linux-gnu/libboost_filesystem.so;/usr/lib/x86_64-linux-gnu/libboost_program_options.so;/usr/lib/x86_64-linux-gnu/libboost_regex.so;/usr/lib/x86_64-linux-gnu/libboost_system.so;/usr/lib/x86_64-linux-gnu/libboost_thread.so;/usr/lib/x86_64-linux-gnu/libpthread.so
Link implementation:
(empty)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring incomplete, errors occurred!
See also "/home/mihai/hhvm/CMakeFiles/CMakeOutput.log".
See also "/home/mihai/hhvm/CMakeFiles/CMakeError.log".
This issue is not happening on an Ubuntu 16.04 machine. I have searched up and down for a solution and found nothing.
Thank you,
Mihai
I suspect that you need a newer version of cmake. It looks like the add_library(name INTERFACE ...) command was added some time after v2.8.12 (which is what ships with ubuntu 14.04).

cmake doesn't find Qt5

Last night I tried to download the disassembler called "Evan's debugger (edb)", that has similar GUI to Ollydbg (Linux only).
I tried to build them via terminal using:
sudo cmake ../edb_folder
With ../edb_folder being the directory containing edb's source code.
It gives me the following error about Qt5:
-- Boost version: 1.58.0
-- Checking for module 'libgvc>=2.38.0'
--
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:26 (find_package):
Could not find a package configuration file provided by "Qt5Svg" with any
of the following names:
Qt5SvgConfig.cmake
qt5svg-config.cmake
Add the installation prefix of "Qt5Svg" to CMAKE_PREFIX_PATH or set
"Qt5Svg_DIR" to a directory containing one of the above files. If "Qt5Svg"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
src/CMakeLists.txt:26 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/kanna/Desktop/build/CMakeFiles/CMakeOutput.log".
But I already have Qt5 installed on my system (see this picture). Why can't cmake find Qt5?
(FYI: I'm using ubuntu 64bits)
go to synaptic and install libqt5svg5 + libqt5svg5-dev + libqt5svg5-private-dev

Boost CMake cannot find python library

After sifting through the many other questions about CMake being unable to find boost libraries I still can't figure my issue out:
My Portion of the CMakeLists related to this:
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost COMPONENTS python REQUIRED)
include_directories("${PROJECT_BINARY_DIR}")
include_directories("${PROJECT_SOURCE_DIR}/src/mazeGen")
include_directories("${PROJECT_SOURCE_DIR}/src/mazeSolve")
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(${EXECUTABLE_NAME} ${Boost_LIBRARIES})
add_executable(${EXECUTABLE_NAME} ${SOURCES} ${HEADERS})
when I specify BOOST_ROOT and try to build the project the error output is:
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1111 (message):
Unable to find the requested Boost libraries.
Boost version: 1.55.0
Boost include path: C:/local/boost_1_55_0
Could not find the following Boost libraries:
boost_python
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
Call Stack (most recent call first):
CMakeLists.txt:36 (find_package)
Where exactly should I point CMake in order to find the libraries? And how can I do this?
all of the built libraries are located in ${BOOST_ROOT}/stage/lib and are built for VS2012, I tried setting BOOST_LIBRARYDIR to ${BOOST_ROOT}/stage/lib but this did nothing

Resources