Skip to content

Commit 7e4aad8

Browse files
author
Noam Preil
committed
Cleanup CMakeLists.txt (step towards #381)
1 parent 03b6fe6 commit 7e4aad8

File tree

1 file changed

+22
-35
lines changed

1 file changed

+22
-35
lines changed

CMakeLists.txt

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
cmake_minimum_required(VERSION 2.8.5)
2+
23
project(scas C)
4+
set(CMAKE_C_STANDARD 99)
5+
# Long term goal: add -Werror
6+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic")
7+
38
if(WIN32)
4-
set(CMAKE_C_FLAGS "-g -std=c99 -Wl,--allow-multiple-definition")
5-
else()
6-
set(CMAKE_C_FLAGS "-g -std=c99")
9+
set(CMAKE_C_FLAGS "-Wl,--allow-multiple-definition")
10+
endif()
11+
12+
if (NOT DEFINED CMAKE_BUILD_TYPE)
13+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type (Debug or Release)" FORCE)
714
endif()
8-
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin/")
9-
add_definitions("-Wall")
10-
set(CMAKE_BUILD_TYPE Debug)
1115

1216
if(EMSCRIPTEN)
1317
set(CMAKE_EXE_LINKER_FLAGS "-O2")
@@ -18,11 +22,6 @@ add_custom_command(
1822
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tables/z80.tab ${CMAKE_CURRENT_SOURCE_DIR}/generate-tables.sh
1923
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/generate-tables.sh ${CMAKE_CURRENT_SOURCE_DIR}/tables/z80.tab ${CMAKE_CURRENT_BINARY_DIR}/tables/z80.c)
2024

21-
include_directories(
22-
include/
23-
scas/
24-
)
25-
2625
FILE(GLOB common ${PROJECT_SOURCE_DIR}/common/*.c)
2726
FILE(GLOB assembler ${PROJECT_SOURCE_DIR}/assembler/*.c)
2827
FILE(GLOB linker ${PROJECT_SOURCE_DIR}/linker/*.c)
@@ -38,6 +37,11 @@ add_executable(scas
3837
${PROJECT_BINARY_DIR}/tables/z80.c
3938
)
4039

40+
include_directories(scas
41+
${CMAKE_SOURCE_DIR}/include/
42+
${CMAKE_SOURCE_DIR}/scas/
43+
)
44+
4145
add_library(libscas SHARED
4246
${common}
4347
${assembler}
@@ -98,44 +102,27 @@ if(SCAS_DOCUMENTATION)
98102

99103
INSTALL(
100104
FILES ${CMAKE_CURRENT_BINARY_DIR}/bin/scas.1
101-
DESTINATION man/man1
105+
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
102106
)
103107

104108
INSTALL(
105109
FILES ${CMAKE_CURRENT_BINARY_DIR}/bin/scdump.1
106-
DESTINATION man/man1
110+
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
107111
)
108112

109113
INSTALL(
110114
FILES ${CMAKE_CURRENT_BINARY_DIR}/bin/scwrap.1
111-
DESTINATION man/man1
115+
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
112116
)
113117

114118
endif()
115119

116120
INSTALL(
117-
TARGETS scas
118-
RUNTIME DESTINATION bin
119-
)
120-
121-
INSTALL(
122-
TARGETS scdump
123-
RUNTIME DESTINATION bin
124-
)
125-
126-
INSTALL(
127-
TARGETS scwrap
128-
RUNTIME DESTINATION bin
129-
)
130-
131-
INSTALL(
132-
TARGETS libscas
133-
ARCHIVE DESTINATION lib
134-
RUNTIME DESTINATION lib
135-
LIBRARY DESTINATION lib
121+
TARGETS scas scdump scwrap libscas
122+
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
123+
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
136124
)
137125

138-
install(
139-
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
126+
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
140127
DESTINATION include/scas
141128
)

0 commit comments

Comments
 (0)