-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
67 lines (54 loc) · 2.52 KB
/
CMakeLists.txt
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
# Copyright (C) 2023 Walt Drummond
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.0...3.7)
project( 6502 )
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(STATUS "Using GCC version: ${CMAKE_CXX_COMPILER_VERSION}")
add_compile_options(-std=gnu++23)
add_compile_options(-W -Wall -pedantic -Wuninitialized -Wshadow)
#add_compile_options(-Weffc++)
add_compile_options(-Werror) #Comment this out if -Weffc++ is enabled
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS " -- DEBUG build")
add_compile_options(-g)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message(STATUS "Using MSVC version: ${CMAKE_CXX_COMPILER_VERSION}")
add_compile_options(/std:c++20)
set_target_properties(${name} PROPERTIES VS_USER_PROPS do_not_import_user.props)
# set_target_properties(${name} PROPERTIES VS_GLOBALVcpkgEnabled false)
#add_compile_options(/MP)
#add_compile_options(/wd4201 /WX)
find_package(fmt CONFIG REQUIRED)
# Tnis path will have to change depending on where vcpkg is.
# Also, this is a hack to make this work on Windows.
include_directories(AFTER "..\\vcpkg\\installed\\x64-windows\\include")
elseif (APPLE)
message(STATUS "Using MacOS compiler: ${CMAKE_CXX_COMPILER_VERSION}")
add_compile_options(-std=gnu++2b)
include_directories(AFTER "/opt/homebrew/include")
find_package(fmt CONFIG REQUIRED)
else()
message(STATUS "Using unknown compiler")
endif()
add_definitions(-DBINFILE_PATH=\"${CMAKE_SOURCE_DIR}/binfiles\")
include_directories(${CMAKE_SOURCE_DIR}/clock ${CMAKE_SOURCE_DIR}/memory ${CMAKE_SOURCE_DIR}/6502
${CMAKE_SOURCE_DIR}/65C02 ${CMAKE_SOURCE_DIR}/tests/src)
set(BINDIR "${CMAKE_BINARY_DIR}/bin")
add_subdirectory(6502)
add_subdirectory(65C02)
add_subdirectory(tests)
add_subdirectory(apple1)
add_subdirectory(tools)