CMake Could NOT find wxWidgets - windows

I am trying to compile SAGA-GIS API on Windows using the following instructions https://sourceforge.net/p/saga-gis/wiki/Compiling%20SAGA%20on%20Windows/
I have followed the compilation step-by-step and gotten to the point of compiling SAGA. As I'm an inexperienced user of CMake, I user CMake-GUI and it's instructions for compiling. However, I keep running into this error
Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
The C compiler identification is MSVC 19.29.30143.0
The CXX compiler identification is MSVC 19.29.30143.0
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
Detecting C compile features
Detecting C compile features - done
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
Detecting CXX compile features
Detecting CXX compile features - done
folder: saga
Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.31.1.windows.1")
GIT_BRANCH: master
VERSON_STRING: 8.4.0
VERSON_FULL_STRING: 8.4.0-256+17a31eb88
compile with OpenMP optimizations
folder: src
folder: accessories
folder: saga_core
CMake Error at C:/Program Files/CMake/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
wxWidgets_INCLUDE_DIRS)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.24/Modules/FindwxWidgets.cmake:977 (find_package_handle_standard_args)
src/saga_core/CMakeLists.txt:16 (find_package)
Configuring incomplete, errors occurred!
See also "C:/saga-gis-code/build/CMakeFiles/CMakeOutput.log".
See screenshot:

Related

Impossible to link SDL2 library to my cmake compiler on Windows

I'm actualy trying to compile a project on windows with the CMakeList.txt that I used to compile the project on linux.
Unfortunatly when I try to compile with windows powershell, cmake is saying :
cmake . -G "MinGW Makefiles"
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at C:/Program Files/CMake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find SDL2_image (missing: SDL2_IMAGE_LIBRARIES)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
cmake/FindSDL2_image.cmake:91 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:12 (find_package)
-- Configuring incomplete, errors occurred!
At the first time it didn't scared me cause I know that I have to download every library and link them to the cmake.
After I download every library like this : screenshot of the files
I tried to link them into my cmake,
firstly adding them to my Environment Variables :screenshot
but that didn't work, he always says "impossible to find SDL2_image when its perfectly working on linux with the cmakeFound...
W/E if someone knows how to compile or add a library to cmake on windows it could be insane for me.

CMake issue when Avast is running

I have an issue when running CMake on Windows 10 when avast antivirus is running.
I wrote a small basic CMakeLists.txt :
cmake_minimum_required(VERSION 3.10)
# set the project name
project(RayTracing)
# add the executable
add_executable(rat_tracing main.cpp)
When I run cmake -G "MSYS Makefiles" CMakeLists.txt with Avast activated I get::
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- Detecting C compiler ABI info
CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/CMakeDetermineCompilerABI.cmake:49 (try_compile):
Failed to open
C:/Users/pc/Documents/C++/MyRayTracing/CMakeFiles/CMakeTmp/CMakeLists.txt
Permission denied
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
CMakeLists.txt:4 (project)
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files/msys64/mingw64/bin/gcc.exe
CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:56 (try_compile):
Failed to open
C:/Users/pc/Documents/C++/MyRayTracing/CMakeFiles/CMakeTmp/CMakeLists.txt
Permission denied
Call Stack (most recent call first):
CMakeLists.txt:4 (project)
-- Check for working C compiler: C:/Program Files/msys64/mingw64/bin/gcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"C:/Program Files/msys64/mingw64/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:4 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/pc/Documents/C++/MyRayTracing/CMakeFiles/CMakeOutput.log".
See also "C:/Users/pc/Documents/C++/MyRayTracing/CMakeFiles/CMakeError.log".
But when I disable Avast, everything works fine and I get :
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/msys64/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/msys64/mingw64/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/pc/Documents/C++/MyRayTracing
I've done some research, but no one seems to have had the same problem. The most similar cases are those where Avast thinks Cmake is a virus.
Thx.
While working on another small c++ project, I find a solution to this problem.
Create a small "Hello word !" program.
main.cpp
#include <iostream>
int main() {
std::cout << "Hello word ! " << std::endl;
return 0;
}
And a small CMakeLists.txt.
CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
# set the project name
project(Tutorial)
# add the executable
add_executable(Tutorial main.cpp)
The use cmake or cmake-gui to configure and build the project.
At this point, a warning from Avast will appear. It will say that CMakeLists.txt is trying to modify a protected directory, in my case it was "C:/Users/pc/Documents/" and will ask if you allow it or not.
Authorize it and it will work on any other project.

Cmake error: Could NOT find Boost (missing: Boost_INCLUDE_DIR)

I am new to Cmake and Boost. I am now working on a program using cmake and need help.
System: windows 7
Cmake version: 3.16.0-rc1
Boost version: boost_1_71_0. And boost is installed through .exe file.
Gcc version: 4.8.1(rev5, Built by MinGW-W64 project)
Visual studio: vs 2015
When I run cmake .. in build dir, no error occurs. The output is:
The C compiler identification is MSVC 19.0.24215.1
The CXX compiler identification is MSVC 19.0.24215.1
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Found Boost: C:/local/boost_1_71_0 (found version "1.71.0")
Boost_Found Success!
Found OpenCV: C:/Users/gph/opencv/binaries (found version "3.4.5")
Found OpenCV: C:/Users/gph/opencv/binaries (found version "3.4.5") found components: core highgui imgproc videoio
Configuring done
But I want to use minGW to compile, so When I rum cmake -G "MinGW Makefiles", error occured saying "Could NOT find Boost (missing: Boost_INCLUDE_DIR)". The output is:
The C compiler identification is GNU 4.8.1
The CXX compiler identification is GNU 4.8.1
Check for working C compiler: C:/MinGW/bin/gcc.exe
Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: C:/MinGW/bin/g++.exe
Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
CMake Error at C:/Users/gph/cmake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find Boost (missing: Boost_INCLUDE_DIR)
Call Stack (most recent call first):
C:/Users/gph/cmake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
C:/Users/gph/cmake/share/cmake-3.16/Modules/FindBoost.cmake:2162 (find_package_handle_standard_args)
CMakeLists.txt:34 (find_package)
Configuring incomplete, errors occurred!
See also "C:/Users/gph/Desktop/libvibe++/build/CMakeFiles/CMakeOutput.log".
How to solve the error when running cmake -G "MinGW Makefiles"? Thanks guys!
I solved this by adding sentence set(BOOST_ROOT C:/local/boost_1_71_0) before find_package(Boost REQUIRED) LOL...
But I still wonder why I need to add this.
You can also set variables BOOST_ROOT during the creation of the cmake project (or CMake options in CLion and other IDE). For example:
mkdir buildtest; cd buildtest
cmake -DBOOST_ROOT=/you_path_to_boost/boost ..
cmake --build . -- -j 4
I had a similar problem on Linux/Manjaro. Make sure you have boost installed, more specifically the boost development headers. I had the boost runtime libraries installed but not the headers. I installed those sudo pacman -S boost and it fixed the problem for me.
After I solved this problem, thanks to ToughMind here, these problems occurred to me: _Boost_COMPONENT_DEPENDENCIES and _Boost_MISSING_DEPENDENCIES. What helped me was to update to the newest cmake verison and I got the answer from here: CMake finds Boost but the imported targets not available for Boost version

OpenMP on windows with clang and cmake

I'm trying to run this cmake file on windows
cmake_minimum_required(VERSION 3.8)
set(CMAKE_C_COMPILER "C:/Program Files/LLVM/bin/clang")
set(CMAKE_CXX_COMPILER "C:/Program Files/LLVM/bin/clang++")
set(OPENMP_LIBRARIES "C:/Program Files/LLVM/lib")
set(OPENMP_INCLUDES "C:/Program Files/LLVM/include")
set(OpenMP_C "${CMAKE_C_COMPILER}")
set(OpenMP_C_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
set(OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp5")
set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libiomp5_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_CXX "${CMAKE_CXX_COMPILER}")
set(OpenMP_CXX_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
set(OpenMP_CXX_LIB_NAMES "libomp" "libgomp" "libiomp5")
set(OpenMP_libomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
set(OpenMP_libgomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
set(OpenMP_libiomp5_LIBRARY ${OpenMP_CXX_LIB_NAMES})
message("!!!!!!!!!!!!!!!! " ${OpenMP_C_FLAGS} )
find_package(OpenMP REQUIRED)
With this command line parameters:
cmake -G"Visual Studio 15 2017" -T LLVM ..
It is strange that I get the fallowing error even if OpenMP_C_FLAGS is defined according to the output:
-- The C compiler identification is Clang 9.0.0
-- The CXX compiler identification is Clang 9.0.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
!!!!!!!!!!!!!!!! -fopenmp=libomp -Wno-unused-command-line-argument
CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.13/Modules/FindOpenMP.cmake:473 (find_package_handle_standard_args)
CMakeLists.txt:25 (find_package)
-- Configuring incomplete, errors occurred!
If I run cmake without -T LLVM flag, then cmake FindOpenMP.cmake runs fine (uses windows compiler). clang doesn't support openmp on windows ?

MAC: missing: ZLIB_INCLUDE_DIR && OPENGL_INCLUDE_DIR

Zlib is supposed to be installed on all mac's by default I'm pretty sure.. But when I run cmake for SFML I get the following errors:
The C compiler identification is Clang 4.1.0
The CXX compiler identification is Clang 4.1.0
Check for working C compiler using: Xcode
Check for working C compiler using: Xcode -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Xcode
Check for working CXX compiler using: Xcode -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Found OpenGL: /System/Library/Frameworks/OpenGL.framework
Found Freetype: /usr/X11R6/lib/libfreetype.dylib (found version "2.4.4")
Found GLEW: /Users/falconmick/Documents/SFML2 src/extlibs/libs-osx/lib/libGLEW.a
Found JPEG: /Users/falconmick/Documents/SFML2 src/extlibs/libs-osx/lib/libjpeg.a
CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (message):
Could NOT find ZLIB (missing: ZLIB_INCLUDE_DIR)
Call Stack (most recent call first):
/Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:291 (_FPHSA_FAILURE_MESSAGE)
/Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/FindZLIB.cmake:85 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
src/SFML/Graphics/CMakeLists.txt:85 (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:
OPENGL_INCLUDE_DIR (ADVANCED)
used as include directory in directory /Users/falconmick/Documents/SFML2 src/src/SFML/Window
Configuring incomplete, errors occurred!
Help CMake to locate it by setting ZLIB_INCLUDE_DIR variable. Either run this:
cmake -D ZLIB_INCLUDE_DIR=/path/to/zlib/include .
in your build directory, or set it via GUI.

Resources