Yaml-cpp / CXX compiler identification is AppleClang - cmake

I'm trying to compile the latest version of yaml-cpp on my MacOS but I got the following error message:
cmake -G "Xcode" -DYAML_BUILD_SHARED_LIBS=on ..
-- The CXX compiler identification is AppleClang 13.0.0.13000029 CMake Error at CMakeLists.txt:10 (project): No CMAKE_CXX_COMPILER could be found.
-- Configuring incomplete, errors occurred! See also "/Users/surrutiaquir/Software/yaml-cpp/build/CMakeFiles/CMakeOutput.log".
What am I doing wrong here? Thanks in advance.

Related

Why is there no CMAKE_CXX_COMPILER

I'm trying to compile nvidia Maxine with cmake but am getting this error
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:7 (project):
No CMAKE_CXX_COMPILER could be found.
Configuring incomplete, errors occurred!```

How to build Aseprite from source in ubuntu 20.04? CMake Warning: "No source or binary directory provided"

I was trying to build Aseprite from its source in Ubuntu 20.04 and got stuck while executing cmake.
I followed all the instructions provided in the install.md file.
This is the output I got after executing cmake :
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.
CMake Deprecation Warning at CMakeLists.txt:16 (cmake_policy):
The OLD behavior for policy CMP0046 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
CMake Error at /usr/share/cmake-3.16/Modules/CMakeCInformation.cmake:84 (include):
include could not find load file:
/home/shree/aseprite/build/laf/cmake/c_flag_overrides.cmake
Call Stack (most recent call first):
CMakeLists.txt:31 (project)
-- 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
CMake Error at /usr/share/cmake-3.16/Modules/CMakeCXXInformation.cmake:89 (include):
include could not find load file:
/home/shree/aseprite/build/laf/cmake/cxx_flag_overrides.cmake
Call Stack (most recent call first):
CMakeLists.txt:31 (project)
-- 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
CMake Error at CMakeLists.txt:41 (message):
Your Aseprite repository is incomplete, initialize submodules using:
git submodule update --init --recursive
-- Configuring incomplete, errors occurred!
See also "/home/shree/aseprite/build/CMakeFiles/CMakeOutput.log".
This error happens because the 'laf' folder is empty. You must download this project from Github and put the content inside that folder.
https://github.com/aseprite/laf/tree/8f91e164d1d23a3b0dc751bc0f9185af27dcb2c7

I get the error of the CXX compiler identification is unknown

I get the following error when I try to use cmake to compile a source code:
$ sudo cmake -DUSE_QT5=1 -DCMAKE_INSTALL_PREFIX=/home/linux/myYade ../trunk
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:35 (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/linux/myYade/trunk/CMakeFiles/CMakeOutput.log".
See also "/home/linux/myYade/trunk/CMakeFiles/CMakeError.log".
Any help to get this resolved?

Why is this find_package failing in newer CMake versions?

I am experiencing a problem in a project, when upgrading from CMake 3.8 to 3.14. I have reduced this to the following issue. Note that project is before find_package (the other way around I do not have the issue I am describing).
cmake_minimum_required(VERSION 3.2.1)
find_package(MPI REQUIRED)
project(Test CXX)).
When I build with CMake 3.8, the output is as follows:
build3_8$ cmake ../source/
-- The CXX compiler identification is Intel 17.0.5.20170817
-- Check for working CXX compiler: (...)/linux/bin/intel64/icpc
-- Check for working CXX compiler: (...)/linux/bin/intel64/icpc -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: (...)/build3_8
With CMake 3.14 I get the following output:
build3_14$ cmake ../source/
CMake Error at (...)/CMake/3.14.0/share/cmake-3.14/Modules/FindPackageHandleStandardArgs.cmake:211 (message):
No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()
Call Stack (most recent call first):
(...)/CMake/3.14.0/share/cmake-3.14/Modules/FindMPI.cmake:1672 (find_package_handle_standard_args)
CMakeLists.txt:3 (find_package)
-- Configuring incomplete, errors occurred!
I wonder why this is happening with the newer CMake version (although FindMPI.cmake is completely different)?
Also, what can I do to solve this? Do I need to write my own config?
(I cannot just change the order of project and find_package, because wrappers are created for the compilers (not my choice, please don't blame me))

Finding GLib with CMake: target_include_directories called with invalid arguments

I have this following (minimal) CMakeLists.txt supposed to find GLib via pkg-config and add the libs to the foo target:
cmake_minimum_required(VERSION 2.10 FATAL_ERROR)
project(foo)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLib REQUIRED glib-2.0)
add_executable(foo foo.cpp)
message(WARNING "libs:" ${GLIB_LIBRARIES})
message(WARNING "includes:" ${GLIB_INCLUDE_DIRS})
target_link_libraries(foo PUBLIC ${GLIB_LIBRARIES})
target_include_directories(foo PUBLIC ${GLIB_INCLUDE_DIRS})
No matter what I try, I get (note the Found glib-2.0 part):
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.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
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'glib-2.0'
-- Found glib-2.0, version 2.56.1
CMake Warning at CMakeLists.txt:6 (message):
libs:
CMake Warning at CMakeLists.txt:7 (message):
includes:
CMake Error at CMakeLists.txt:9 (target_include_directories):
target_include_directories called with invalid arguments
-- Configuring incomplete, errors occurred!
See also "/tmp/aaa/CMakeFiles/CMakeOutput.log".
and I cannot see, reading the CMake reference what arguments are invalid (note: this question is different from cmake target_include_directories called with invalid arguments). I also looked at CMake's FindPkgConfig documentation which gives glib as an example and I am not able to reproduce it (${GLIB_VERSION}). I tried GLIB_ and GLIB2_ prefixes and all I get is empty strings.
The messages show the variables are empty, though pkg-config reports values correctly:
$ pkg-config glib-2.0 --cflags --libs
-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lglib-2.0
The CMake version I have is 2.10.
Can someone shed light on the issue?
I think your problem is the casing of GLIB_INCLUDE_DIRS and GLIB_LIBRARIES. They should be GLib_INCLUDE_DIRS and GLib_LIBRARIES since you specified "GLib" as the first argument of pkg_check_modules. I'm guessing that the target_include_directories() doesn't like not getting any arguments after the
PUBLIC (although it works for me in cmake 3.5).