Cmake doesn't see variable from find_path - c++

I am trying to compile code with activemq-cpp with cmake and gcc 5.4
find_path(ACTIVEMQCPP_DIR NAMES cms/Config.h HINTS $ENV{ACTIVEMQDIR})
Here ACTIVEMQDIR is an environment variable set to
/usr/local/include/activemq-cpp-3.10.0
message(STATUS ACTIVEMQCPP_DIR=${ACTIVEMQCPP_DIR})
include_directories(${ACTIVEMQCPP_DIR})
//include_directories(/usr/local/include/activemq-cpp-3.10.0)
If i hardcode path explicitly, then it is ok...
Output from cmake:
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- 1=/usr/local/include/activemq-cpp-3.10.0
-- 2=/usr/local/lib
-- 3=/usr/local/include/activemq-cpp-3.10.0
-- 4=/usr/local/lib/libactivemq-cpp.so
-- Configuring done
-- Generating done
-- Build files have been written to
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
ACTIVEMQCPP_DIR=/usr/local/include/activemq-cpp-3.10.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/oem/ClionProjects/untitled/b2
The problem is that include_directories(${ACTIVEMQCPP_DIR}) doesn't work. Variable ACTIVEMQCPP_DIR is not set

Write it like this
include_directories($ENV{ACTIVEMQCPP_DIR})
so that cmake knows it's an environemnt variable.

Related

Can't get CLion to actually use GCC compiler instead of Clang?

I've tried following all the help to change my compiler to use GCC instead of Clang (on macOS) as I would like to try to use __gnu_pbds::priority_queue instead of the STL version, and it still appears that CMake uses Clang. I've made a toolchain that looks like this:
and set it to be used in the CMake profile.
However, it appears CMake skips actually using the compiler - here is the CMake output:
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -G "CodeBlocks - Unix Makefiles" -S /Users/steve/CLionProjects/TestModernTimeStretch -B /Users/steve/CLionProjects/TestModernTimeStretch/cmake-build-release-gcc
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - 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: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for stdbool.h
-- Looking for stdbool.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Checking processor clipping capabilities...
-- Performing Test CPU_CLIPS_POSITIVE
-- Performing Test CPU_CLIPS_POSITIVE - Failed
-- Performing Test CPU_CLIPS_NEGATIVE
-- Performing Test CPU_CLIPS_NEGATIVE - Failed
-- Checking processor clipping capabilities... none
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/steve/CLionProjects/TestModernTimeStretch/cmake-build-release-gcc

When Cross Compiling (Linux to Windows) The Vulkan Loader There Are Many Undefined References to Vulkan Objects

When using the mingw-32 cmake the code from https://github.com/KhronosGroup/Vulkan-Loader fails to compile this is the cmake command I am using:x86_64-w64-mingw32-cmake -DVULKAN_HEADERS_INSTALL_DIR=/usr/x86_64-w64-mingw32/ -DVulkanRegistry_DIR=/usr/x86_64-w64-mingw32/share/vulkan/registry/ -DUSE_MASM=OFF ..
Which Outputs:
-- The C compiler identification is GNU 11.1.0
-- The CXX compiler identification is GNU 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc - 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: /usr/bin/x86_64-w64-mingw32-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found VulkanHeaders: /usr/x86_64-w64-mingw32/include
-- Found VulkanRegistry: /usr/x86_64-w64-mingw32/share/vulkan/registry
-- Detected Vulkan Version 1.2.182
-- Looking for secure_getenv
-- Looking for secure_getenv - not found
-- Looking for __secure_getenv
-- Looking for __secure_getenv - not found
CMake Warning at loader/CMakeLists.txt:27 (message):
Using non-secure environmental lookups. This loader will not properly
disable environent variables when run with elevated permissions.
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/flippers2652/Documents/Temp/Vulkan-Loader/build
Output from make: https://pastebin.pl/view/7467739f
Thank you.
P.S. Distrobution is manjaro.
The problem was that I had a MASM assembler. Which caused it to attempt an assembly thing that it failed to do.

Switching back to Clang compiler for mac terminal

When compiling my code, in terminal I used to see:
>-- The CXX compiler identification is AppleClang 12.0.0.12000032
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Check for working CXX compiler: >/Library/Developer/CommandLineTools/usr/bin/c++ - skipped
> -- Detecting CXX compile features
> -- Detecting CXX compile features - done
For unrelated reasons, I wanted the compiler to be GCC instead of Apple Clang. So in terminal, I set
CC=/usr/local/Cellar/gcc/11.1.0_1/bin/gcc-11
and
CXX=/usr/local/Cellar/gcc/11.1.0_1/bin/g++-11
in an attempt to switch from clang to gcc as the compiler used in terminal. But I would get the following error message:
> -- The CXX compiler identification is unknown
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - failed
> -- Check for working CXX compiler: /usr/bin/c++
> -- Check for working CXX compiler: /usr/bin/c++ - broken
> CMake Error at /usr/local/Cellar/cmake/3.20.5/share/cmake/Modules/CMakeTestCXXCompiler.cmake:59 (message):
>The C++ compiler
>/usr/bin/c++
>is not able to compile a simple test program.
Now I want to switch back to clang and tried setting
CC=/usr/bin/clang
and
CXX=/usr/bin/clang++
in terminal, but I now get the same error message as above where the compiler is unknown.

Cmake FindBoost error-POP without matching PUSH

I am trying to install LightGBM-gpu on Centos. It seems boost 1.56 can be find, but this error occurred.I google it all day but can not solve it.
Here is the Message
$ cmake -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda/include/ ..
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -fopenmp (found version "3.1")
-- Found OpenMP_CXX: -fopenmp (found version "3.1")
-- Looking for CL_VERSION_2_0
-- Looking for CL_VERSION_2_0 - not found
-- Looking for CL_VERSION_1_2
-- Looking for CL_VERSION_1_2 - found
-- Found OpenCL: /usr/local/cuda/lib64/libOpenCL.so (found version "1.2")
-- OpenCL include directory: /usr/local/cuda/include
Boost 1.56.0 found.
Found Boost components:
filesystem;system
CMake Error in /usr/local/share/cmake-3.9/Modules/FindBoost.cmake:
cmake_policy POP without matching PUSH
Call Stack (most recent call first):
CMakeLists.txt:144 (find_package)
-- Performing Test MM_PREFETCH
-- Performing Test MM_PREFETCH - Success
-- Using _mm_prefetch
-- Performing Test MM_MALLOC
-- Performing Test MM_MALLOC - Success
-- Using _mm_malloc
-- Configuring incomplete, errors occurred!
See also "/home/rd/LightGBM/build/CMakeFiles/CMakeOutput.log".
See also "/home/rd/LightGBM/build/CMakeFiles/CMakeError.log".
This question was cross-posted to the LightGBM issues page as microsoft/LightGBM#3613. The issue was solved there.
Updating CMake to at least version 3.14 fixes this issue.

Plugin refuses to compile due to COMPILER_SUPPORTS_CXX11 test failing

This is the following output i keep getting when i run the commands
I'm not sure exactly where im going wrong here. I'm also having issues with boost yum says the boost libraries installed.
cmake teamspeak-connector
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /opt/rh/devtoolset-2/root/usr/bin/gcc
-- Check for working C compiler: /opt/rh/devtoolset-2/root/usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /opt/rh/devtoolset-2/root/usr/bin/c++
-- Check for working CXX compiler: /opt/rh/devtoolset-2/root/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Failed
CMake Error at CMakeLists.txt:73 (message):
The compiler /opt/rh/devtoolset-2/root/usr/bin/c++ does not fulfill all
required standards. Please use a different C++ compiler.
-- Configuring incomplete, errors occurred!
See also "/root/sampcompiles/samp-tsconnector-1.2.1/CMakeFiles/CMakeOutput.log".
See also "/root/sampcompiles/samp-tsconnector-1.2.1/CMakeFiles/CMakeError.log".