-
Notifications
You must be signed in to change notification settings - Fork 37
/
CMakeLists.txt
45 lines (39 loc) · 1.1 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
cmake_minimum_required(VERSION 2.4)
project(acc)
if(MSVC)
# Create list of _FLAGS variables
foreach(FLAGS_SUFFIX "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
set(FLAGS_VARIABLES ${FLAGS_VARIABLES} CMAKE_C_FLAGS${FLAGS_SUFFIX} CMAKE_CXX_FLAGS${FLAGS_SUFFIX})
endforeach()
# Change compiler flags to use static runtime
foreach(FLAGS_VARIABLE ${FLAGS_VARIABLES})
if(${FLAGS_VARIABLE} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${FLAGS_VARIABLE} "${${FLAGS_VARIABLE}}")
endif()
endforeach()
endif()
if (NOT APPLE AND NOT MSVC)
# use static runtimes on Linux and MinGW
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -static -static-libgcc -static-libstdc++")
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -static -static-libgcc -static-libstdc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++")
endif()
add_executable(acc
acc.c
error.c
misc.c
parse.c
pcode.c
strlist.c
symbol.c
token.c
common.h
error.h
misc.h
parse.h
pcode.h
strlist.h
symbol.h
token.h
)
install(TARGETS acc RUNTIME DESTINATION bin)