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?
Related
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)
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.
This is in my CMakeLists.txt:
cmake_minimum_required(VERSION 3.1.0)
project(myProject)
set(EXECUTABLE_OUTPUT_PATH ./bin/${CMAKE_BUILD_TYPE})
find_package(Boost REQUIRED COMPONENTS filesystem)
I compiled Boost 1.64.0 from source. The Boost compilation succeeded, and the filesystem headers are present in the Boost installation directory. I then pointed Boost_INCLUDE_DIR to its base folder (the one containing bootstrap and b2.exe).
I get this CMake output:
CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
Could NOT find Boost (missing: filesystem) (found version "1.64.0")
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.18/Modules/FindBoost.cmake:2177 (find_package_handle_standard_args)
CMakeLists.txt:9 (find_package)
Configuring incomplete, errors occurred!
What does this mean? How can CMake "NOT find Boost", but find version 1.64.0?
I am using CMAKE to try to load Boost library into my project. (I'm using CLion as IDE). Here is my CMAKE file:
cmake_minimum_required(VERSION 3.14)
project(untitled2)
set(Boost_USE_STATIC_LIBS ON) # only find static libs
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(Boost_INCLUDE_DIR C/Users/User/Downloads/boost_1_68_0/boost_1_68_0/libs)
find_package(Boost 1.68.0 COMPONENTS system filesystem REQUIRED)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(untitled2 ${Boost_LIBRARIES})
endif()
add_executable(untitled2 main.cpp)
set(CMAKE_CXX_STANDARD 14)
Here is my directory (C/Users/User/Downloads/boost_1_68_0/boost_1_68_0/):
When reloading CMAKE file I get this error:
CMake Error at C:/Program Files/JetBrains/CLion 2019.1.4/bin/cmake/win/share/cmake-3.14/Modules/FindBoost.cmake:1388 (file):
file STRINGS file
"C:/Users/User/CLionProjects/untitled2/C/Users/User/Downloads/boost_1_68_0/boost_1_68_0/libs/boost/version.hpp"
cannot be read.
Call Stack (most recent call first):
CMakeLists.txt:8 (find_package)
CMake Error at C:/Program Files/JetBrains/CLion 2019.1.4/bin/cmake/win/share/cmake-3.14/Modules/FindBoost.cmake:2147 (message):
Unable to find the requested Boost libraries.
Boost version: 0.0.0
Boost include path: C/Users/User/Downloads/boost_1_68_0/boost_1_68_0/libs
Detected version of Boost is too old. Requested version was 1.68 (or
newer).
Call Stack (most recent call first):
CMakeLists.txt:8 (find_package)
-- Configuring incomplete, errors occurred!
See also "C:/Users/User/CLionProjects/untitled2/cmake-build-debug/CMakeFiles/CMakeOutput.log".
[Failed to reload]
Any suggestions why it fails??
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?