-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
83 lines (70 loc) · 2.23 KB
/
CMakeLists.txt
File metadata and controls
83 lines (70 loc) · 2.23 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
78
79
80
81
82
83
cmake_minimum_required(VERSION 3.30)
project(LifeSim
VERSION 0.1.0
DESCRIPTION "A basic cellular life simulator, using randomly generated JASM bytecode as DNA, powered by CSR."
LANGUAGES CXX
)
if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "^(GNU|Clang)")
message(
FATAL_ERROR
"Sorry this project is meant to be compiled with a GNU/Clang compiler.
since it uses features supported only by those two. I never tested with MSVC
of any other though, if you really want to give it a shot, you can remove this
check in the main CMakeLists.txt file."
)
endif (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "^(GNU|Clang)")
set(TARGET_NAME "lifesim")
#
# Link libstdc++ statically if compiling with mingw. because it
# requires the dlls otherwise.
#
message(STATUS "Checking CXX compiler.")
get_filename_component(CXX_COMPILER_NAME ${CMAKE_CXX_COMPILER} NAME)
if("${CXX_COMPILER_NAME}" STREQUAL "x86_64-w64-mingw32-g++")
message(STATUS "Using ${CXX_COMPILER_NAME}, linking libstdc++ statically.")
add_link_options(
"-static"
"-static-libstdc++"
"-static-libgcc"
)
endif("${CXX_COMPILER_NAME}" STREQUAL "x86_64-w64-mingw32-g++")
#
# CLI Arguments
#
#
# File Configures
#
configure_file(
${PROJECT_SOURCE_DIR}/LifeSimConfig.hpp.in
${PROJECT_BINARY_DIR}/include/LifeSimConfig.hpp
@ONLY
)
include_directories(
${PROJECT_SOURCE_DIR}/include
${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/include/CSR
)
# After the include call so everything includes those above
add_subdirectory(lib)
add_subdirectory(src)
add_executable(${TARGET_NAME}
src/main.cpp
)
set_target_properties(${TARGET_NAME}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/${OUTPUT_PATH}/lib"
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin//${OUTPUT_PATH}/lib"
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/${OUTPUT_PATH}/"
)
# Add postbuild commands here
#add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
# COMMAND ${CMAKE_COMMAND} -E copy_directory
# "${LIBSTDJASM_OUTPUT_DIR}"
# "${PROJECT_BINARY_DIR}/bin/${OUTPUT_PATH}/"
#)
#end_command
target_link_libraries(${TARGET_NAME}
PUBLIC
_src
_libs
)