Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centos7, vcpkg, cmake: can't find header files #1605

Open
RotateAt60MPH opened this issue Apr 1, 2021 · 0 comments
Open

Centos7, vcpkg, cmake: can't find header files #1605

RotateAt60MPH opened this issue Apr 1, 2021 · 0 comments

Comments

@RotateAt60MPH
Copy link

RotateAt60MPH commented Apr 1, 2021

I should call this YACFF: yet another can't find files. :)

I'm trying to get a cmake (3.19.7) build project working under CentOS7 to build a library 'Common'. I've installed boost and cpprestsdk packages under vcpkg, but I cannot get the build to find cpprestsdk header files.

Here's my CMakeList.txt:

cmake_minimum_required(VERSION 3.15-3.19)

set(CMAKE_VERBOSE_MAKEFILE ON)
project(Common)

message(STATUS "** Building ${PROJECT_NAME} **")

file(GLOB SOURCES "*.cpp")
file(GLOB HEADERS "*.h")

find_package(cpprestsdk CONFIG REQUIRED)

add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS})
target_precompile_headers(${PROJECT_NAME} PUBLIC stdafx.h)

# PUBLIC needed to make library available elsewhere in project
target_include_directories(${PROJECT_NAME}
    PUBLIC ${PROJECT_SOURCE_DIR}/..)

if(CMAKE_BUILD_TYPE_INIT STREQUAL "Debug")
  set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "CommonD")
endif()

# Tell compiler to use C++20 features. The code doesn't actually use any of them.
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11)

My cmake and make CLI steps are:

everest /home/Devel/Cores/generator/lib/Common $ cmake \
  -DCMAKE_TOOLCHAIN_FILE=/home/Devel/vcpkg/scripts/buildsystems/vcpkg.cmake \
  -DCMAKE_PREFIX_PATH=/home/Devel/vcpkg/installed/x64-linux/share/cpprestsdk .
...

everest /home/Devel/Cores/generator/lib/Common $ make all
/usr/local/bin/cmake -S/home/Devel/Cores/generator/lib/Common -B/home/Devel/Cores/generator/lib/Common --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/bin/cmake -E cmake_progress_start /home/Devel/Cores/generator/lib/Common/CMakeFiles /home/Devel/Cores/generator/lib/Common//CMakeFiles/progress.marks
make  -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/Devel/Cores/generator/lib/Common'
make  -f CMakeFiles/Common.dir/build.make CMakeFiles/Common.dir/depend
make[2]: Entering directory '/home/Devel/Cores/generator/lib/Common'
cd /home/Devel/Cores/generator/lib/Common && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /home/Devel/Cores/generator/lib/Common /home/Devel/Cores/generator/lib/Common /home/Devel/Cores/generator/lib/Common /home/Devel/Cores/generator/lib/Common /home/Devel/Cores/generator/lib/Common/CMakeFiles/Common.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/Devel/Cores/generator/lib/Common'
make  -f CMakeFiles/Common.dir/build.make CMakeFiles/Common.dir/build
make[2]: Entering directory '/home/Devel/Cores/generator/lib/Common'
[  7%] Building CXX object CMakeFiles/Common.dir/cmake_pch.hxx.gch
/opt/rh/devtoolset-7/root/usr/bin/c++  -I/home/Devel/Cores/generator/lib/Common/..  -Winvalid-pch -x c++-header -include /home/Devel/Cores/generator/lib/Common/CMakeFiles/Common.dir/cmake_pch.hxx -o CMakeFiles/Common.dir/cmake_pch.hxx.gch -c /home/Devel/Cores/generator/lib/Common/CMakeFiles/Common.dir/cmake_pch.hxx.cxx
In file included from /home/Devel/Cores/generator/lib/Common/stdafx.h:4:0,
                 from /home/Devel/Cores/generator/lib/Common/CMakeFiles/Common.dir/cmake_pch.hxx:5,
                 from <command-line>:0:
/home/Devel/Cores/generator/lib/Common/Common.h:49:10: fatal error: cpprest/json.h: No such file or directory
 #include <cpprest/json.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/Common.dir/build.make:86: CMakeFiles/Common.dir/cmake_pch.hxx.gch] Error 1
make[2]: Leaving directory '/home/Devel/Cores/generator/lib/Common'
make[1]: *** [CMakeFiles/Makefile2:98: CMakeFiles/Common.dir/all] Error 2
make[1]: Leaving directory '/home/Devel/Cores/generator/lib/Common'
make: *** [Makefile:106: all] Error 2

It should be able to find the needed .cpprestsdk-config.cmake file, I believe

everest /home/Devel/vcpkg/installed/x64-linux/share/cpprestsdk (master)$ ls -l
total 32
-rw-r--r-- 1 1120 Mar 30 18:24 copyright
-rw-r--r-- 1 486 Mar 30 18:24 cpprestsdk-config.cmake
-rw-r--r-- 1 431 Mar 30 18:24 cpprestsdk-config-version.cmake
-rw-r--r-- 1 4536 Mar 30 18:24 cpprestsdk-targets.cmake
-rw-rw-r-- 1 860 Mar 30 18:24 cpprestsdk-targets-debug.cmake
-rw-r--r-- 1 858 Mar 30 18:24 cpprestsdk-targets-release.cmake
-rw-rw-r-- 1 1472 Mar 30 18:24 vcpkg_abi_info.txt

Any advice appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant