简体   繁体   中英

CMake cannot find header file near the source one

I don't want to install sqlite globally in my system, so I have downloaded the sqlite3 files from https://www.sqlite.org/2018/sqlite-amalgamation-3240000.zip and have copied sqlite3.c and sqlite3.h into the project folder.

CMakeLists.txt:

cmake_minimum_required(VERSION 3.10)
project(learn_cpp)

set(CMAKE_CXX_STANDARD 11)

add_executable(learn_cpp main.cpp)

main.cpp :

#include <iostream>
#include "sqlite3.h"

int main() {

    return 0;
}

I am not getting any of the functions from sqlite3.h as suggestion in the CLion IDE.

By default, CMake doesn't search headers files in the current directory. For enable this behaviour, set CMAKE_INCLUDE_CURRENT_DIR variable:

set(CMAKE_INCLUDE_CURRENT_DIR ON)

add_executable(learn_cpp main.cpp ...)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM