-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
69 lines (50 loc) · 2.13 KB
/
Copy pathCMakeLists.txt
File metadata and controls
69 lines (50 loc) · 2.13 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
# # Specify the minimum version of CMake required
# cmake_minimum_required(VERSION 3.10)
# # Set the project name and version
# project(MyProject VERSION 1.0 LANGUAGES CXX)
# # Set the C++ standard to C++11 (or any other version you need)
# set(CMAKE_CXX_STANDARD 17)
# set(CMAKE_CXX_STANDARD_REQUIRED True)
# # Add include directory
# include_directories(${PROJECT_SOURCE_DIR}/include)
# # Add source files
# file(GLOB SOURCES "${PROJECT_SOURCE_DIR}/src/*.cpp")
# # Create the executable
# add_executable(warden ${SOURCES})
# # Optionally, link libraries if needed
# target_link_libraries(warden fmt)
# # Specify where the executable will be installed
# install(TARGETS warden DESTINATION bin)
# # Install header files
# install(DIRECTORY include/ DESTINATION include)
# Specify the minimum version of CMake required
cmake_minimum_required(VERSION 3.10)
# Set the project name and version
project(MyProject VERSION 1.0 LANGUAGES CXX)
# Set the C++ standard to C++17 (or any other version you need)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Add include directory
include_directories(${PROJECT_SOURCE_DIR}/include)
# Add source files
file(GLOB SOURCES "${PROJECT_SOURCE_DIR}/src/*.cpp")
# Create the executable
add_executable(warden ${SOURCES})
# Specify where the executable will be installed
install(TARGETS warden DESTINATION bin)
if(EXISTS "${PROJECT_SOURCE_DIR}/include")
# Install header files (ensure the directory exists)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include)
else()
message(WARNING "Include directory does not exist; skipping installation of headers.")
endif()
# Define installation rules for different platforms
if(WIN32)
# Install the application for Windows
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install")
install(CODE "message(\"Installing on Windows: Executable will be in ${CMAKE_INSTALL_PREFIX}/bin\")")
# You might want to adjust PATH environment variable or use CPack to create an installer
else()
# Default install prefix for Unix-like systems
install(CODE "message(\"Installing on Unix-like OS: Executable will be in /usr/local/bin\")")
endif()