Unknown CMake command: "_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS" - boost

Environment:
Windows 10
CMake 3.12.4
Boost 1.68.0 installed from pre-compiled binary "boost_1_68_0-msvc-14.0-64.exe" downloaded from here.
Problem:
When calling find_package(Boost COMPONENTS ...), FindBoost.cmake reports an error:
CMake Error at C:/Program
Files/CMake/share/cmake-3.12/Modules/FindBoost.cmake:1535
(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS):
Unknown CMake command
"_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS".
How to fix it? Thanks.

Related

Using MSVC with cmake on Travis CI Windows

I have a C++ project that uses cmake as it's build system and I'm trying to setup CI on Windows with Travis CI.
I'm installing the MSVC BuildTools using the following inside a powershell script
choco install visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
I'm struggling to get cmake to recognize and use cl.exe as the compiler though. I can pass the absolute path with -DCMAKE_CXX_COMPILER which results in the following error:
CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/CMakeTestCXXCompiler.cmake:59 (message):
The C++ compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/travis/build/Project/CMakeFiles/CMakeTmp

MSYS2 (64 bit): The C compiler identification is unknown

I'm new to building in Windows. I'm building the following project: https://github.com/arkottke/strata.
The page suggests installing dependencies using MSYS2. I've installed MSYS2 and installed everything as instructed exactly, but I get the following when trying to build using cmake:
$ cmake .. -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:31 (project):
No CMAKE_C_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error at CMakeLists.txt:31 (project):
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "/home/isb17182/strata/build/CMakeFiles/CMakeOutput.log".
See also "/home/isb17182/strata/build/CMakeFiles/CMakeError.log".
I've seen answers for the same problem on other building platforms, but these are too complicated for me to understand currently. If someone could provide a simple explanation of how to resolve this it would be much appreciated.
Thanks
This is what worked for me
Thanks to everyone who contributed.
Run
pacman -S base-devel gcc
Which will update GCC to latest and verify by
gcc --version
Be sure you're using the cmake of msys2 (as the project build instructions suggest you should install), not a regular Windows cmake installed elsewhere on the system.
which cmake
After this ere execute your command...build done ;)

CMake "Could NOT find OpenSSL" with MSYS2/mingw64 on Windows

I'm trying to compile this project on Windows using MSYS2 with mingw64, and when running cmake . I get the following output:
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.16299.
-- Build type: Release
-- Source of Randomness: random_device
CMake Error at C:/msys64/mingw64/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY) (found
version "1.1.1b")
Call Stack (most recent call first):
C:/msys64/mingw64/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
C:/msys64/mingw64/share/cmake-3.13/Modules/FindOpenSSL.cmake:412 (find_package_handle_standard_args)
CMakeLists.txt:10 (find_package)
I have OpenSSL installed, as evidenced by:
$ which openssl
/mingw64/bin/openssl
$ openssl version
OpenSSL 1.1.1b 26 Feb 2019
And the OPENSSL_CRYPTO_LIBRARY that it seems to be looking for is either /mingw64/lib/libcrypto.a or /mingw64/lib/libcrypto.dll.a.
What's really throwing me for a loop is that in the CMake error message, it says "found version 1.1.1b", so clearly it is able to find it. Anyone have suggestions on how to resolve this error?
Turns out, I needed to add -G "Unix Makefiles" to my cmake command. By default it was producing Visual Studio solutions/projects, which is not what you want in mingw, and by adding this flag it was able to find the openssl files.

CMake Error: Could not find openSSL or GCrypt

I'm trying to use CMake in order to get libssh binaries for Windows.
I have Windows 7 OS and VS 2010.
I installed OpenSSL and set in CMake the entries OPENSSL_INCLUDE_DIR and OPENSSL_ROOT_DIR. After that, I get the following error:
Could NOT find NSIS (missing: NSIS_MAKE)
Could NOT find OpenSSL (missing: OPENSSL_LIBRARIES)
Could NOT find GCrypt, try to set the path to GCrypt root folder in the system variable GCRYPT_ROOT_DIR (missing: GCRYPT_INCLUDE_DIR GCRYPT_LIBRARIES)
CMake Error at CMakeLists.txt:57 (message):
Could not find OpenSSL or GCrypt
Any help will be welcome...
Thanks in advance
Worked out after I set the entries SSL_EAY_DEBUG and SSL_EAY_RELEASE.

CMake with MinGW and Eclipse CDT

I'm trying to compile OpenCV with Cmake on Windows 7 (64-bit). It is to be used with Eclipse and CDT, for which I read somewhere that youhave to specify Unix Makefiles regardless of the compiler.
Now, given that I have cygwin as well (for Android NDK stuff), I first tried using its compilers, and I successfully configure CMake and generate makefiles, but only get to 63% of compiling, when OpenCV spits an error (about ffmpeg and HMODULE). So I switched to MinGW (HelloWorld with it was also a pain, I had to specify a full path to MinGW g++ regardless of the PATH variable setting), but now I cannot even configure CMake. I get the following error:
The C compiler identification is GNU
The CXX compiler identification is GNU
CMake Error: your RC compiler: "CMAKE_RC_COMPILER-NOTFOUND" was not found. Please set CMAKE_RC_COMPILER to a valid compiler path or name.
Check for working C compiler: C:/MinGW/bin/gcc.exe
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeRCInformation.cmake:22 (GET_FILENAME_COMPONENT):
get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-GNU.cmake:59 (enable_language)
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-GNU-C.cmake:1 (include)
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:56 (INCLUDE)
CMakeLists.txt:2 (PROJECT)
CMake Error: CMAKE_RC_COMPILER not set, after EnableLanguage
CMake Error: Internal CMake error, TryCompile configure of cmake failed
Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "C:/MinGW/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:47 (project)
Configuring incomplete, errors occurred!
If anyone has any idea what might be a problem (conflict with cygwin shell?), I'd appreciate any input. Thanks in advance!
We ran into the same problem with the "Unix Makefiles" Generator. We solved it by using the "MSYS Makefiles" generator (Msys is a shell environment around MinGW, like [a very small] cygwin).
This error message text:
CMake Error: your RC compiler: "CMAKE_RC_COMPILER-NOTFOUND" was not found.
Please set CMAKE_RC_COMPILER to a valid compiler path or name.
indicates that "windres" (for mingw and cygwin gcc-based build trees) is not in the PATH.
windres support, to compile Windows resource (*.rc) files was recently added in CMake 2.8.4. Perhaps windres is not available in your MinGW environment?

Resources