0

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!

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
  • "The compiler does not recognize ..." - Do not *describe* the error message. Instead, paste the error message into the question post **exactly as it is**. – Tsyvarev Jan 26 '22 at 16:01
  • The error message has nothing common with the compiler: It is emitted by CMake itself (during the configuration all error messages are from CMake). The error message means that your `find_path` call failed to find `crow.h` file, so it cannot set variable `CROW_INCLUDE_DIRS` to some meaningful value. Later in your code you are using this variable as include directory, and this is your error. – Tsyvarev Jan 26 '22 at 16:18

2 Answers2

1

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.

0

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")
Alex Reinking
  • 16,724
  • 5
  • 52
  • 86