forked from alucardthefish/CodeNowHere
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
77 lines (73 loc) · 2.72 KB
/
CMakeLists.txt
File metadata and controls
77 lines (73 loc) · 2.72 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
72
73
74
75
76
77
cmake_minimum_required(VERSION 3.0)
project(cnh)
set(CNH_BINARY_DEST "bin")
if (WIN32)
set(CMAKE_INSTALL_PREFIX "c:/program files/")
set(CNH_BINARY_DEST "cnh")
endif (WIN32)
# set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CONFIG_H ${CMAKE_BINARY_DIR}/config.h)
string(TIMESTAMP CURRENT_TIMESTAMP)
file(WRITE ${CONFIG_H} "/* WARNING: This file is auto-generated by CMake on ${CURRENT_TIMESTAMP}. DO NOT EDIT!!! */\n\n")
include_directories(headers ${CMAKE_BINARY_DIR} )
# Since we have created a config.h add a global define for it
add_definitions("-DHAVE_CONFIG_H")
# stop MSVC complaining
add_definitions("-D_CRT_SECURE_NO_WARNINGS")
add_definitions("-DDATA_LOCATION=\"${CMAKE_INSTALL_PREFIX}/cnh\"")
add_definitions("-DTEMPLATE_LOCATION=\"${CMAKE_INSTALL_PREFIX}/cnh_templates\"")
add_subdirectory(src)
add_subdirectory(tests)
# install(DIRECTORY "extdata/"
# DESTINATION "${CMAKE_INSTALL_PREFIX}/cnh"
# FILES_MATCHING PATTERN *.tpl)
# install(FILES "extdata/InlineComments.txt" "extdata/lang.dat"
# DESTINATION "${CMAKE_INSTALL_PREFIX}/cnh")
# install(DIRECTORY "templates/"
# DESTINATION "${CMAKE_INSTALL_PREFIX}/cnh_templates"
# FILES_MATCHING PATTERN *.tpl)
# install(TARGETS cnh
# DESTINATION ${CNH_BINARY_DEST})
install(DIRECTORY "extdata/"
DESTINATION "cnh"
FILES_MATCHING PATTERN *.tpl)
install(FILES "extdata/InlineComments.txt" "extdata/lang.dat"
DESTINATION "cnh")
install(DIRECTORY "templates/"
DESTINATION "cnh_templates"
FILES_MATCHING PATTERN *.tpl)
install(TARGETS cnh
RUNTIME DESTINATION "bin"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib")
# Set package metadata
set(CPACK_PACKAGE_NAME "CodeNowHere")
set(CPACK_PACKAGE_VERSION "3.0.0") # Replace with your versioning logic
set(CPACK_PACKAGE_CONTACT "sergiop18@gmail.com")
# Set platform-specific settings
if(WIN32)
set(CPACK_GENERATOR "NSIS") # Use NSIS for Windows
set(CPACK_PACKAGE_FILE_NAME "cnh-windows-${CPACK_PACKAGE_VERSION}")
elseif(APPLE)
set(CPACK_GENERATOR "DragNDrop") # Use DragNDrop for macOS
set(CPACK_PACKAGE_FILE_NAME "cnh-macos-${CPACK_PACKAGE_VERSION}")
else()
set(CPACK_GENERATOR "DEB") # Use DEB for Linux
set(CPACK_PACKAGE_FILE_NAME "cnh-linux-${CPACK_PACKAGE_VERSION}")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Sergio Ortiz Paz") # Required for DEB
endif()
# Enable CPack
include(CPack)
# uninstall target
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
COMMENT "Uninstalling files installed by 'make install'"
)
endif()