CMake Error:
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find libxmp (missing: libxmp_LIBRARY libxmp_INCLUDE_PATH)
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
vendor/SDL_mixer/cmake/Findlibxmp.cmake:17 (find_package_handle_standard_args)
vendor/SDL_mixer/CMakeLists.txt:616 (find_package)
My CMakeLists.txt:
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
set(ProjectName SnakeGameSDL)
set(RootSources src/main.cpp src/Map.cpp src/Game.cpp)
set(RootHeaders src/Map.hpp src/Game.hpp)
add_executable(${ProjectName} ${RootSources} ${RootHeaders})
add_subdirectory(src/CSDLContext)
add_subdirectory(src/CAppSettings)
add_subdirectory(src/CollideSystem)
add_subdirectory(src/FontManager)
add_subdirectory(src/Food)
add_subdirectory(src/GameScenes)
add_subdirectory(src/GameScore)
add_subdirectory(src/Observer)
add_subdirectory(src/AchievementSystem)
add_subdirectory(src/Snake)
add_subdirectory(src/SoundManager)
add_subdirectory(src/SpriteAnimation)
add_subdirectory(src/TextureManager)
add_subdirectory(src/Timer)
#Vendor
add_subdirectory(vendor/SDL)
target_link_libraries(${ProjectName} SDL)
add_subdirectory(vendor/SDL_image)
target_link_libraries(${ProjectName} SDL_image)
add_subdirectory(vendor/SDL_ttf)
target_link_libraries(${ProjectName} SDL_ttf)
add_subdirectory(vendor/SDL_mixer)
target_link_libraries(${ProjectName} SDL_mixer)
I have to add in vendor libxmp library and specify path or something like this in SDL_mixer cmake file or its completly wrong?. My target is to build project or there some more easier ways to get what i want?
Not really a fix but for now no error,
i just added this line in my root CMakeLists.txt
set(SDL2MIXER_VENDORED ON CACHE BOOL "" FORCE) <-- this one
add_subdirectory(vendor/SDL_mixer)
target_link_libraries(${ProjectName} SDL_mixer)
Related
I'm running CMake by this command:
cmake -DCMAKE_PREFIX_PATH=deps/build/destdir/usr/local -DBoost_NO_BOOST_CMAKE=ON ..
But, this error is received:
ldd: warning: you do not have execution permission for
`/home/m3/repos/cpp-service/deps/build/destdir/usr/local/lib/libopenvdb.a'
not a dynamic executable
Call Stack (most recent call first):
/usr/local/lib64/cmake/OpenVDB/FindOpenVDB.cmake:550
(get_prerequisites) linux.cmake:29 (find_package)
CMakeLists.txt:28 (include)
Problem
I think the problem is due to the fact that I have libopenvdb.a installed in two paths:
/usr/local/lib64/ inside my system filesystem
deps/build/destdir/usr/local/lib/ inside my source code tree
I intend to use the OpenVDB inside my source code tree, not the system one. I don't have enough CMake expertise. How can I avoid such conflicts?
As #U.W. commented, the CMake file was problematic.
In my CMake file I had such statements:
list(APPEND CMAKE_MODULE_PATH "/usr/local/lib64/cmake/OpenVDB/")
find_package(OpenVDB REQUIRED)
target_link_libraries(
${PROJECT_NAME} PUBLIC
OpenVDB::openvdb)
The error got resovled by replacing the above statements with these ones:
list(
APPEND CMAKE_MODULE_PATH
"/home/m3/repos/cpp-service/deps/build/destdir/usr/local/lib/cmake/OpenVDB")
set(OPENVDB_USE_STATIC_LIBS ON)
find_package(OpenVDB REQUIRED)
target_link_libraries(
${PROJECT_NAME} PUBLIC
OpenVDB::openvdb)
so I was trying to link to wxWidgets with CMake, and I couldn't get it to work. Here is my CMakeLists.txt.
cmake_minimum_required(VERSION 3.20.1)
set(CMAKE_CXX_STANDARD 20)
project(FormApplication)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
set(EXE_NAME run)
find_package(wxWidgets REQUIRED gl core base OPTIONAL_COMPONENTS net)
include(${wxWidgets_USE_FILE})
add_subdirectory(src) # creates an exe named ${EXE_NAME}
target_link_libraries(${EXE_NAME} PRIVATE ${wxWidgets_LIBRARIES})
I get the following error when running cmake -S . -G "Ninja" -B build
CMake Error at C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
wxWidgets_INCLUDE_DIRS gl core base)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.20/Modules/FindwxWidgets.cmake:1025 (find_package_handle_standard_args)
CMakeLists.txt:7 (find_package)
Why do I get this error? Every source I go to has a different answer, but none of them have worked so far. Some even say you can't link to wxWidgets with cmake.
Please help, I've been trying to get this to work for a couple days already. Thanks in advance.
I downloaded the mpich-3.3.2 archive (stable release) from the official site, unpacked it and concluded that I have the MPICH library. But I can’t add it to Clion. Here is my CMakeLists.txt:
cmake_minimum_required(VERSION 3.15)
project(MyProject)
set(CMAKE_CXX_STANDARD 17)
find_package(MPI REQUIRED)
include_directories(${MPI_INCLUDE_PATH})
SET(CMAKE_C_COMPILER mpicc)
SET(CMAKE_CXX_COMPILER mpicxx)
add_executable(MyProject main.cpp)
I tried to enter different things in CMakeLists.txt, but always the same thing:
-- Could NOT find MPI_C (missing: MPI_C_LIB_NAMES MPI_C_HEADER_DIR MPI_C_WORKS)
-- Could NOT find MPI_CXX (missing: MPI_CXX_LIB_NAMES MPI_CXX_HEADER_DIR MPI_CXX_WORKS)
CMake Error at C:/Program Files/JetBrains/CLion 2019.3.4/bin/cmake/win/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND)
Call Stack (most recent call first):
C:/Program Files/JetBrains/CLion 2019.3.4/bin/cmake/win/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/JetBrains/CLion 2019.3.4/bin/cmake/win/share/cmake-3.16/Modules/FindMPI.cmake:1700 (find_package_handle_standard_args)
CMakeLists.txt:6 (find_package)
What am I doing wrong? How should Clion find out the location of MPICH on my computer?
I have cygwin in c:\cygwin64 and boost_1_64_0 in /usr/src file. Here is my CMakeLists.txt:
set(BOOST_HOME /usr/src/boost_1_64_0)
set(BOOST_INCLUDEDIR /usr/src/boost_1_64_0/boost)
cmake_minimum_required(VERSION 3.8)
project(spider)
set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILES main.cpp)
set(THREADS_PREFER_PTHREAD_FLAG ON)
include_directories(boost ${BOOST_HOME})
find_package(Threads REQUIRED)
find_package(Boost 1.64.0 COMPONENTS system filesystem REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(spider ${SOURCE_FILES})
target_link_libraries(spider ${Boost_LIBRARIES})
target_link_libraries(spider Threads::Threads)
Clion starts cmake this way:
C:\Users\steve\.CLion2017.2\system\cygwin_cmake\bin\cmake.exe --build C:\Users\steve\Dropbox\Projects\cpp-spider\cmake-build-debug --target spider -- -j 1
I get this error:
CMake Warning at /cygdrive/c/Users/steve/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/FindBoost.cmake:765 (message):
Imported targets not available for Boost version
Call Stack (most recent call first):
/cygdrive/c/Users/steve/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/FindBoost.cmake:869 (_Boost_COMPONENT_DEPENDENCIES)
/cygdrive/c/Users/steve/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/FindBoost.cmake:1472 (_Boost_MISSING_DEPENDENCIES)
CMakeLists.txt:17 (find_package)
CMake Warning at /cygdrive/c/Users/steve/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/FindBoost.cmake:765 (message):
Imported targets not available for Boost version
Call Stack (most recent call first):
/cygdrive/c/Users/steve/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/FindBoost.cmake:869 (_Boost_COMPONENT_DEPENDENCIES)
/cygdrive/c/Users/steve/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/FindBoost.cmake:1472 (_Boost_MISSING_DEPENDENCIES)
CMakeLists.txt:17 (find_package)
CMake Error at /cygdrive/c/Users/steve/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/FindBoost.cmake:1842 (message):
Unable to find the requested Boost libraries.
Unable to find the Boost header files. Please set BOOST_ROOT to the root
directory containing Boost or BOOST_INCLUDEDIR to the directory containing
Boost's headers.
Call Stack (most recent call first):
CMakeLists.txt:17 (find_package)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Boost_INCLUDE_DIR (ADVANCED)
used as include directory in directory /cygdrive/c/Users/steve/Dropbox/Projects/cpp-spider
used as include directory in directory /cygdrive/c/Users/steve/Dropbox/Projects/cpp-spider
used as include directory in directory /cygdrive/c/Users/steve/Dropbox/Projects/cpp-spider
-- Configuring incomplete, errors occurred!
See also "/cygdrive/c/Users/steve/Dropbox/Projects/cpp-spider/cmake-build-debug/CMakeFiles/CMakeOutput.log".
make: *** [Makefile:176: cmake_check_build_system] Error 1
How can I diagnose the reason of the problem? Any idea how I can fix it?
I have written a c++ program and run it in linux ubuntu. my program's name is: "find_relation_1.cpp" and this is its cmakelist.txt:
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(find_relation_1)
find_package(PCL 1.2 REQUIRED)
find_package(Qt4 REQUIRED)
find_package(Qt COMPONENTS QtXml REQUIRED)
include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
include_directories(${PCL_INCLUDE_DIRS} ${QT_INCLUDE_DIRS} ${QT_USE_FILE})
link_directories(${PCL_LIBRARY_DIRS} ${QT_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS} ${QT_DEFINITIONS})
add_executable (find_relation_1 find_relation_1.cpp)
target_link_libraries (find_relation_1 ${PCL_LIBRARIES})
target_link_libraries (find_relation_1 opencv_core opencv_imgproc opencv_video ${EXTERNAL_LIBS} ${QT_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_LIBRARIES} ${QT_QTXML_LIBRARY})
I had no problems and my program was running successfully after "cmake .." and "make".
Then I changed the name of the folder which my program:"find_relation_1.cpp" and its cmakelist: "CmakeList.txt" were in that. This time after writing cmake .. in the Terminal I received this error:
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
Could NOT find Qt4 (missing: QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE
QT_UIC_EXECUTABLE) (found version "4.8.6")
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-2.8/Modules/FindQt4.cmake:1171 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:7 (find_package)
-- Configuring incomplete, errors occurred!
Then I changed the name of the folder to its previous name while I had no problem but still this message is appeared after writing "cmake .." when I want to run my program. What is the reason for this error?