I want to use cmake to build my project, my CMakeLists.txt is very simple:
cmake_minimum_required(VERSION 3.20)
project(YuvParallelProcess)
message("$(PROJECT_SOURCE_DIR)")
include_directories($(PROJECT_SOURCE_DIR)/inc)
link_directories($(PROJECT_SOURCE_DIR)/lib/libyuv)
add_executable(YuvParallelProcess $(PROJECT_SOURCE_DIR)/src/main.cpp)
target_link_libraries(YuvParallelProcess libyuv.a)
my project files are organized as follows:
YuvParallelProcess
build
data
inc
lib
src
CMakeLists.txt
when I run cmake .. in build directory, the shell prints:
$(PROJECT_SOURCE_DIR)
-- Configuring done
CMake Error at CMakeLists.txt:10 (add_executable):
Cannot find source file:
$(PROJECT_SOURCE_DIR)/src/main.cpp
CMake Error at CMakeLists.txt:10 (add_executable):
No SOURCES given to target: YuvParallelProcess
I don't know why the shell just prints $(PROJECT_SOURCE_DIR) other than the value of PROJECT_SOURCE_DIR
How can I print the value of PROJECT_SOURCE_DIR
By the way, I can't figure out why cmake failed to compile my project