Crow microframework - CMake Error: The following variables are used in this project, but they are set to NOTFOUND

961 Views Asked by At

Here is the full error message:

Error CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
C:/Users/DELL/source/repos/CMakeProject1/CMakeProject1/CROW_INCLUDE_DIRS
   used as include directory in directory C:/Users/DELL/source/repos/CMakeProject1/CMakeProject1        C:\Users\DELL\source\repos\CMakeProject1\   used as include directory in directory C            

I am trying to use the Crow microframework but can't seem to make it work. I have downloaded the Crow package off of Github : https://github.com/ipkn/crow and used CMake to run a hello world from the Crow port. This is what I got in my .txt file

cmake_minimum_required (VERSION 3.8)

find_path(CROW_INCLUDE_DIRS "crow.h")

add_executable (CMakeProject1  "example_with_all.cpp" "crow_all.h")

target_include_directories(CMakeProject1 PRIVATE ${CROW_INCLUDE_DIRS})

My header file is crow_all.h which contains all the libraries and this is where the error is located. The compiler does not recognize all the "#include" used in this header file. I believed it would work because I had downloaded the entire Github repo and included it in my files.

My cpp file just includes the header file and does a Hello World.

I am a beginner at CMake, thank you for the help!

2

There are 2 best solutions below

0
Alex Reinking On

Wow, crow's build is so broken that its own instructions fail on my system... it also hasn't been updated since 2017 (five years...). Assuming you still want to use it, I would just copy their amalgamated header, crow_all.h, into my source tree under, say, third_party/crow/crow_all.h and then write:

cmake_minimum_required(VERSION 3.22)
project(example)

add_executable(app "example_with_all.cpp")
target_include_directories(app PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/third_party/crow")
0
Farook Al-Sammarraie On

You should check out https://github.com/CrowCpp/Crow. It's an actively maintained version of the framework with a new build system (you should be able to just link it via CMake)

P.S. I suggest you use the master branch since it has quite a few improvements over the latest release.