Структура проекта:
CMakeLists.txt
cmake_minimum_required(VERSION 3.2)
project(2DPrimitive CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#add_subdirectory(tests/googletest)
add_subdirectory(source)
/source/CMakeLists.txt
cmake_minimum_required(VERSION 3.2)
project(2DPrimitive)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 1)
set(SOURCES
Point.cpp
Window.cpp)
set(HEADERS
Point.hpp
Window.hpp)
set(EXTERN_LIBS
ExternalDependencies/lib/libglad.a
ExternalDependencies/lib/libglfw3.a)
add_library(2DPrimitive STATIC $(SOURCES) $(HEADERS))
target_link_libraries(2DPrimitive ${EXTERN_LIBS})
set_target_properties(2DPrimitive PROPERTIES
OUTPUT_NAME 2DPrimitive
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
SOVERSION ${PROJECT_VERSION_MAJOR}
POSITION_INDEPENDENT_CODE ON
FOLDER "../lib/")
Проблема при генерации makefile-a:
CMake Error at source/CMakeLists.txt:23 (add_library):
Cannot find source file:
$(SOURCES)
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
.hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc
CMake Error at source/CMakeLists.txt:23 (add_library):
No SOURCES given to target: 2DPrimitive