-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
71 lines (59 loc) · 1.83 KB
/
CMakeLists.txt
File metadata and controls
71 lines (59 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
cmake_minimum_required(VERSION 3.16)
project(logos_module VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
# Find Qt6
find_package(Qt6 REQUIRED COMPONENTS Core)
# Define source files
set(MODULE_LIB_SOURCES
src/module_metadata.cpp
src/logos_module.cpp
)
set(MODULE_LIB_HEADERS
src/module_metadata.h
src/logos_module.h
src/module_lib.h
)
# Create the static library
add_library(logos_module STATIC ${MODULE_LIB_SOURCES} ${MODULE_LIB_HEADERS})
# Link Qt6
target_link_libraries(logos_module PUBLIC Qt6::Core)
# Include directories for building
target_include_directories(logos_module PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include/module_lib>
)
# Install the library
install(TARGETS logos_module
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
# Install headers to include/module_lib/
install(FILES ${MODULE_LIB_HEADERS}
DESTINATION include/module_lib
)
# Add command-line binary
add_subdirectory(cmd)
# Testing (optional)
option(LOGOS_MODULE_BUILD_TESTS "Build tests" OFF)
if(LOGOS_MODULE_BUILD_TESTS)
# Try to find Google Test first (for Nix and system installations)
# Fall back to FetchContent if not found
find_package(GTest QUIET)
if(NOT GTest_FOUND)
message(STATUS "GTest not found, fetching from GitHub")
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.14.0
)
# Prevent overriding the parent project's compiler/linker settings on Windows
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
endif()
enable_testing()
include(GoogleTest)
add_subdirectory(tests)
endif()