Finding OpenBLAS on Windows with CMake - c++

I followed the instructions here:
https://github.com/xianyi/OpenBLAS/wiki/How-to-use-OpenBLAS-in-Microsoft-Visual-Studio
for building and installing OpenBLAS, specifically 1. "Native (MSVC) ABI".
And now all the includes and libraries and CMake files are in C:/opt like it wanted.
I then saw I could use FindBLAS in my project's CMakeFile so I added
FindBLAS(), but apparently it's not a command?
I saw everyone who mentioned FindBLAS instead wrote:
set(BLA_VENDOR OpenBLAS)
find_package(BLAS REQUIRED)
so I'm actually pretty confused. What is FindBLAS? Why can't I find any examples of anyone using it?
But then I tried the set and find_package route I saw everywhere and got:
CMake Error at C:/Program Files/CMake/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find BLAS (missing: BLAS_LIBRARIES)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.25/Modules/FindBLAS.cmake:1346 (find_package_handle_standard_args)
I tried setting the environment variables, resetting, everything I can think of. I'm not sure why CMake refuses to find the library and update ${BLAS_LIBRARIES}.

Related

CMake cannot find OpenSSL libraries in windows

This is my cmake file:
cmake_minimum_required(VERSION 3.5.1)
set(PACKAGE_NAME "atest")
find_package(OpenSSL REQUIRED)
project(${PACKAGE_NAME} LANGUAGES C CXX)
I have a custom openssl binary that I wanna use in a folder
C:\MyOpenSSL\
C:\MyOpenSSL\include\ ... all the include files here
C:\MyOpenSSL\lib\ ... libssl.lib, libcrypto.lib and ossl_static.pdb
So when I run, CMake . -DOPENSSL_ROOT_DIR=C:\MyOpenSSL\
I get the following errors:
C:/cmake/cmake-3.22.2-win/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (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.1c")
Call Stack (most recent call first):
C:/cmake/cmake-3.22.2-win/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/cmake/cmake-3.22.2-win/share/cmake-3.22/Modules/FindOpenSSL.cmake:574 (find_package_handle_standard_args)
CMakeLists.txt:5 (find_package)
What am I missing here? Is somehow find_package found out the version v1.1.1c, but still saying it couldn't find it?
It turns out if I build and install openssl manually it works.
For whatever reason the raw lib i provided was not good enough for cmake to find it. I am still not sure why.

Keep receiving "CMake Error: Could NOT find Boost" yet it did find it

Cloned a repository and installed the Boost library. My IDE (CLion) keeps telling me
CMake Error at C:/Program Files/JetBrains/CLion 2021.3/bin/cmake/win/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Boost (missing: regex date_time system filesystem
unit_test_framework program_options) (found version "1.67.0")
Call Stack (most recent call first):
C:/Program Files/JetBrains/CLion 2021.3/bin/cmake/win/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/JetBrains/CLion 2021.3/bin/cmake/win/share/cmake-3.21/Modules/FindBoost.cmake:2345 (find_package_handle_standard_args)
CMakeLists.txt:29 (find_package)
Prior to this, I was trying to use the most updated Boost library which led me to more errors, after changing it to the correct library, those errors went away, leaving me with this. This error also remains when trying to use the new library too.
I have tried set(BOOST_ROOT C:/local/boost_1_71_0) as was the correct answer on another similar post, yet it didn't work. I have also tried adding it to my path, which also does nothing. To note: It is strange because it says the version number of the Boost library yet it says could not be found.
I am using CLion's bundled CMake, but I also have the official CMake installed just in case. I don't think CLion's cmake is the issue.

CMAKE - Could't find boost

I have a problem with Cmake. Every library i want to configure and generate it shows me:
CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230
(message): Could NOT find Boost (missing: Boost_INCLUDE_DIR system serialization)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594(_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.22/Modules/FindBoost.cmake:2360 (find_package_handle_standard_args)
CMake/HighFiveTargetDeps.cmake:27 (find_package)
CMakeLists.txt:63 (include)
I have no idea what should I do. Right now Im trying to generate HighFive library for C++ and it shows me the same problem like in Shark library, Shogun library, Opencv, Eigen, Xtensor... Any idea what should I do? I'll be glad for every answer.
It looks like the project you are trying to compile requires the Boost include libraries. Did you install them? If not, you need to install Boost first.
Then you can take a look at this post, which has a similar problem in my opinion. The accepted answer explained the following system variables were added (please adapt your paths and version numbers):
BOOST_INCLUDEDIR C:\SDKs\boost_1_58_0\
BOOST_LIBRARYDIR C:\SDKs\boost_1_58_0\lib64-msvc-12.0
BOOST_ROOT C:\SDKs\boost_1_58_0\boost

Issues using Armadillo as a library with CLion & CMake on Windows 10

I'm trying to use the Armadillo library inside a CLion project on Windows 10, but when I try to build via Reload CMake Project (using the built-in CMake compiler), this error appears after a short while:
CMake Error at C:/Program Files/JetBrains/CLion 2017.2.3/bin/cmake/share/cmake-3.8/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find Armadillo (missing: ARMADILLO_LIBRARY) (found version
"0.0.0")
Call Stack (most recent call first):
C:/Program Files/JetBrains/CLion 2017.2.3/bin/cmake/share/cmake-3.8/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/JetBrains/CLion 2017.2.3/bin/cmake/share/cmake-3.8/Modules/FindArmadillo.cmake:77 (find_package_handle_standard_args)
CMakeLists.txt:4 (find_package)
I've downloaded the library's content from here and moved it into a folder located at ${PROGRAM FILES}\Armadillo. To use it in my project, I used the FindArmadillo module like this:
find_package(Armadillo REQUIRED) # this is where the error occurs
include_directories(${ARMADILLO_INCLUDE_DIRS})
...
add_executable(MyProject ${SOURCE_FILES})
target_link_libraries(MABE ${ARMADILLO_LIBRARIES})
Is there something I am missing? Do I have to compile the library (or something like that) before I can use it in my project? Or did I maybe mess up the download?
Thanks in advance!
not sure if this is still relevant, but for a small project you can save your unzipped files in your project root directory and then add this line to your CMakeLists.txt:
target_include_directories(YOURPROJECTNAME PUBLIC armadillo/include)
I am just a beginner and found this to be the easiest solution to add many libraries :)
Hope this helps!

Linking of Openscenegraph libraries for CMake

Well,I am new to CMake and want to edit flight simulation code in eclipse instead of visual studio. For that purpose, I downloaded the source code of Simgear, CMake, Boost libraries, open scene graph and openalsoft.
Now I have all the data available but I dont know where to place some of these libraries. As a result, when I run CMake and give reference to my flightgear code, it complains that the openscenegraph libraries are not installed.
Please help me with where I need to put all these files so as to convert my code to eclipse using CMake. I have already installed boost and openal libraries. Only issue is of openscenegraph libraries which I put in program files at the following path "C:\Program Files\OpenSceneGraph-3.4.0" but CMake can't access it. The error code is
Eclipse version is set to 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.
version is 2016 dot 3 dot 1
ignoring: ^C:/Media/Project/study material/flight gear/simgear-2016.3.1/.git;\\.gitignore;Makefile.am;~$;
Library installation directory: lib
Boost version: 1.62.0
SimGear mode: NORMAL
Found OpenAL: C:/Program Files/OpenAL/OpenAL32.lib
Sound support: ENABLED
Could NOT find osgText (missing: OSGTEXT_LIBRARY OSGTEXT_INCLUDE_DIR)
Could NOT find osgSim (missing: OSGSIM_LIBRARY OSGSIM_INCLUDE_DIR)
Could NOT find osgDB (missing: OSGDB_LIBRARY OSGDB_INCLUDE_DIR)
Could NOT find osgParticle (missing: OSGPARTICLE_LIBRARY OSGPARTICLE_INCLUDE_DIR)
Could NOT find osgGA (missing: OSGGA_LIBRARY OSGGA_INCLUDE_DIR)
Could NOT find osgViewer (missing: OSGVIEWER_LIBRARY OSGVIEWER_INCLUDE_DIR)
Could NOT find osgUtil (missing: OSGUTIL_LIBRARY OSGUTIL_INCLUDE_DIR)
Could NOT find osg (missing: OSG_LIBRARY OSG_INCLUDE_DIR)
Could NOT find OpenThreads (missing: OPENTHREADS_LIBRARY OPENTHREADS_INCLUDE_DIR)
CMake Error at C:/Program Files/CMake/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
Could NOT find OpenSceneGraph (missing: OPENSCENEGRAPH_LIBRARIES
OPENSCENEGRAPH_INCLUDE_DIR OSGTEXT_FOUND OSGSIM_FOUND OSGDB_FOUND
OSGPARTICLE_FOUND OSGGA_FOUND OSGVIEWER_FOUND OSGUTIL_FOUND OSG_FOUND
OPENTHREADS_FOUND) (Required is at least version "3.2.0")
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.7/Modules/FindOpenSceneGraph.cmake:223 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:243 (find_package)
Configuring incomplete, errors occurred!
See also "C:/Users/shajeeh/Documents/CMake/CMakeFiles/CMakeOutput.log".
I'm not a CMake expert, here some things I did in order to create ROS & OSG project in Linux:
add an environment variable (if it is not there yet) to the .bashrc file:
export PATH=${PATH}: .../OpenSceneGraph-3.4.0/bin (your absolute path)
then in CMake file add:
FIND_PACKAGE ( OpenSceneGraph COMPONENTS osgSim osgUtil osgDB osgFX osgGA osgTerrain osgViewer osgText osgWidget osgManipulator osg osgShadow)
target_link_libraries(name_of_your_executable ${PROJECT_NAME} ${OPENSCENEGRAPH_LIBRARIES})
For more information check CMake documentation here and here