Very frustrating problem with cmake - windows

I am having a frustrating problem with cmake on windows. i have the kde libs installed.
when i am trying to compile my project with cmake . this shoots up again and again.
Found Qt-Version 4.7.0 (using C:/Qt/2010.05/qt/bin/qmake.exe)
CMake Error at c:/Program Files/KDE/share/apps/cmake/modules/FindPackageHandleStandardArgs.cmake:198 (MESSAGE):
Did not find automoc4 (Automoc4Config.cmake, part of kdesupport).
(missing: AUTOMOC4_EXECUTABLE)
Call Stack (most recent call first):
c:/Program Files/KDE/share/apps/cmake/modules/FindAutomoc4.cmake:56 (find_package_handle_standard_args)
c:/Program Files/KDE/share/apps/cmake/modules/FindKDE4Internal.cmake:402 (find_package)
C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindKDE4.cmake:95 (FIND_PACKAGE)
CMakeLists.txt:96 (find_package)
Configuring incomplete, errors occurred!
Well i was digging around the net for this problem. and i got the automoc4 file which were missing with the default kde-win-installer. So i downloaded the files and ran cmake for the automoc4 and got the automoc4.exe which i place in the %KDE_INSTALL%/bin folder. But luck was not with me. And again my favorite error fires up.
Help me on this!!

Problem solved thanks to patrick and the kde-windows team
download the following files from this url
then open cmake-gui select the browse source to the downloaded folder, and build source to some folder.
generate the cmake , open cmd and navigate to the build folder and type mingw-make.
U then get the automoc4.exe.
1. place it in the %KDE_INSTALL%\bin.
2. Then place Automoc4Config.cmake,Automoc4.files.in and Automoc4Version.cmake in %KDE_INSTALL%\lib\automoc4.
Now just try now.

From what I can see, it seems that CMake is unable to find automoc4.
For CMake to find the excecutable, add the %KDE_INSTALL%/bin folder to the PATH environment variable. There might be a better way to fix this though.
Maybe you should take a look at Automoc4Confid.cmake to see where it looks for the thing. You should find that in the modules folder under the CMake folder

Related

CMake cant find Boost

When configuring, the logs show the following in red, I've included version and OS if it helps.
Windows 10
CMake 3.25.1
Boost 1.81.0
Visual Studio 17 2022
CMake Warning at F:/My_Project/Cmake/share/cmake-3.25/Modules/FindBoost.cmake:1384 (message):
New Boost version may have incorrect or missing dependencies and imported targets
Call Stack (most recent call first):
F:/My_Project/Cmake/share/cmake-3.25/Modules/FindBoost.cmake:1507 (_Boost_COMPONENT_DEPENDENCIES)
F:/My_Project/Cmake/share/cmake-3.25/Modules/FindBoost.cmake:2118 (_Boost_MISSING_DEPENDENCIES)
deps/boost/CMakeLists.txt:35 (find_package)
Boost_DIR = Boost_DIR-NOTFOUND
Boost_FILESYSTEM_LIBRARY_DEBUG = Directory is correct
...
Boost_SYSTEM_LIBRARY_RELEASE = Directory is correct
Just to be on the safe side, I added "BOOST_ROOT" and the directory to both "User variables" and S"ystem variables".
Now, I've already used the bootstrap.bat, followed by the b2.exe. CMake shows the directory for everything else except the BOOST_DIR. When I click on configure, it still shows these errors.
From https://www.azerothcore.org/wiki/windows-core-installation
If you get an error that CMake *Could NOT find Boost (missing: system filesystem program_options iostreams regex) (found suitable version "1.74.0", minimum required is "1.70")
Locate your Boost folder
Run the Bootstrap.bat file
Run the b2.exe file
You can try a diffrent version of boost like latest one 1.81
https://netix.dl.sourceforge.net/project/boost/boost-binaries/1.81.0/boost_1_81_0-msvc-14.3-64.exe
i'm useing this version
don't forget you must edit system variables for this version directory
and don't forget you must use slash / for directory not back slash \ like this:
orginal location: C:\local\boost_1_81_0
on system variables: C:/local/boost_1_81_0
enter image description here

How to find Google Test with find_package using CMake on Windows?

I have tried without success to use the find_package function in CMake to make use of a pre-built "system wide" version of GTest in Windows. Here is a minimal, reproducible example of my CMakeLists.txt:
cmake_minimum_required(VERSION 3.2)
find_package(GTest REQUIRED)
if(NOT GTEST_LIBRARY)
message("GTest not found!")
endif()
I try to generate build files using the following command:
cmake .. -G"Visual Studio 14 2015" -DGTEST_ROOT="c:\Libs\googletest"
The c:\Libs\googletest path contains my pre-built GTest (with header files and binaries). I have studied the FindGTest.cmake file in my CMake installation (I use CMake version 3.13.3) and tried all kinds of folder structure, but I always get the following error message:
CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR
GTEST_MAIN_LIBRARY)
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/FindGTest.cmake:196 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:2 (find_package)
Has anyone succeeded in using find_package for GTest in Windows? If so, how did you do it?
First you must build AND install Googletest using CMake build system
Then try to locate the GTestConfig.cmake file in the installation directory
So now you can add this path to the CMAKE_PREFIX_PATH variable.
Thus configuring your project using CMake, it should be able to find_package(GTest) using the usual search procedure.
So you just have to use GTest::GTest to consume it (i.e. target_link_libraries(.... GTest::GTest) ).
note: For people using FetchContent/add_subdirectory(googletest) beware google/googletest still not provide ALIAS target see https://github.com/google/googletest/issues/2429

Cmake Could not find wxWigets

I want to compile a source code on windows using CMake, it uses wxWigets library.
I downloaded the wxWigets from the page: https://www.wxwidgets.org/
After building by Visual Studio, I got the library /lib file.
I have already set PATH for wxWidgets_LIBRARIES and wxWidgets_INCLUDE_DIRS. But the following errors cannot be resolved.
CMake Error at C:/Program Files/CMake/share/cmake-3.11/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
wxWidgets_INCLUDE_DIRS)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.11/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.11/Modules/FindwxWidgets.cmake:953 (find_package_handle_standard_args)
CMakeLists.txt:52 (find_package)
I also read the thread about this problem in: CMake could not find wxWidgets on Windows
But there is no solution for my case.
You may specify wxWidgets_ROOT_DIR variable to point to your wxWidgets installation.
As far as I understand, you may set either CMake variable via -D option to cmake:
cmake -DwxWidgets_ROOT_DIR:PATH=D:/path/to/wxWidgets/ ...
or you may set environment variable
set wxWidgets_ROOT_DIR=D:\path\to\wxWidgets\ ...
(Note that CMake path variables use "universal" directory separator '/', but environment variables use native directory separator, '\' for Windows).
This variable is described in documentation for FindwxWidget.
Using wxWidgets_LIB_DIR variable could be tricky, see that question.
I have a solution witch can solve this problem.
there is something wrong with the FindwxWidgets.cmake File
Firstly, delete the file
C:/Program Files/CMake/share/cmake-3.11/Modules/FindwxWidgets.cmake
instead, you can find the package by using wxWidetsConfig.cmake file
YOUR_PATH\wxWidgets\lib\cmake\wxWidgets\wxWidgetsConfig.cmake.
add the flowing codes in your CMakeLists.txt and you can use wxWidgets
# set(CMAKE_PREFIX_PATH C:/dev/wxWidgets) also works
set(CMAKE_PREFIX_PATH C:/dev/wxWidgets/lib/cmake/wxWidgets)
find_package(wxWidgets COMPONENTS core base REQUIRED)
add_executable(wxwdemo WIN32 main.cpp)
target_link_libraries(wxwdemo ${wxWidgets_LIBRARIES})
target_include_directories(wxwdemo PUBLIC ${wxWidgets_INCLUDE_DIRS})
then it works

How to compile libgit2 on windows using cmake?

I am trying to compile libgit2 and followed the instruction on https://libgit2.github.com/docs/guides/build-and-link/ but lock so far.
Can someone tell me what to do?
Here is the result from my command line:
-- Building for: Visual Studio 12 2013
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- zlib was not found; using bundled 3rd-party sources.
-- LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.
CMake Error at d:/cmake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
Call Stack (most recent call first):
d:/cmake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
d:/cmake/share/cmake-3.3/Modules/FindPythonInterp.cmake:162 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:594 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
See also "D:/temp/gitlib/libgit2-master/build/CMakeFiles/CMakeOutput.log".
See also "D:/temp/gitlib/libgit2-master/build/CMakeFiles/CMakeError.log".
Thanks,
libgit2 uses python (works both with versions 2 and 3 of the language) to build the tests. You can install python or ask CMake not to build the tests.
IIRC CMake will look in a few standard locations you don't necessarily need python in your path, though it doesn't hurt.
If you would rather not build the tests, you can pass -DBUILD_CLAR=OFF so it doesn't bother looking for python.
Download Python from Paython.org and install it (i.e. d:\python). Then Open your VS command line and type PATH D:\Python\Python35-32;d:\cmake\bin;%PATH%
That's all set now, go to your build folder run cmake .. and then cmake --build .

CMake unable to find my Windows installation of wxWidgets

I've tried to link wxWidgets 3.0.2 to my C++ project but CMake can't seem to find it.
The wxWidgets that I'm trying to get CMake to find is from wxMSW-Setup-3.0.2.exe
This is the error it gives me:
-- Building for: Visual Studio 12 2013
CMake Error at D:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find wxWidgets (missing: wxWidgets_FOUND)
Call Stack (most recent call first):
D:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
D:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindwxWidgets.cmake:871 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:66 (find_package)
-- Configuring incomplete, errors occurred!
CMakeLists.txt:66 refers to this line:
find_package(wxWidgets REQUIRED core base)
I've tried changing the CMake generator, and running set(wxWidgets_ROOT_DIR "C:/wxWidgets-3.0.2"), both of which didn't fix the problem.
CMake is version 3.3.1.
I think cmake used environement variable to find wxwidgets. You have to set wxDir or wxWin variable to C:/wxWidgets-3.0.2
Use find_package(wxWidgets REQUIRED gl core base OPTIONAL_COMPONENTS net) instead of find_package(wxWidgets REQUIRED COMPONENTS core base). And when you build the wxWidgets https://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW, use build the static libraries instead of dynamic libraries, I fixed it by using these two steps.

Resources