Updated README with better build info
[debian/pforth] / csrc / CMakeLists.txt
1 # pforth/csrc/CMakeLists.txt
2 # Extended by Phil Burk 2021-10-31
3 # License: BSD Zero
4
5 file(STRINGS sources.cmake SOURCES)
6
7 if(WIN32)
8 set(PLATFORM stdio/pf_fileio_stdio.c win32_console/pf_io_win32_console.c )
9 endif(WIN32)
10
11 if(UNIX OR APPLE)
12 set(PLATFORM posix/pf_io_posix.c stdio/pf_fileio_stdio.c)
13 endif(UNIX OR APPLE)
14
15 if (MSVC)
16     # warning level 4 and all warnings as errors
17     add_compile_options(/W4 /WX)
18 else()
19     # lots of warnings and all warnings as errors
20     add_compile_options(
21 #        --std=c89
22         -fsigned-char
23         -fno-builtin
24         -fno-unroll-loops
25         -pedantic
26         -Wcast-qual
27         -Wall
28         -Werror
29         -Wwrite-strings
30         -Winline
31         -Wmissing-prototypes
32         -Wmissing-declarations
33         )
34 endif()
35
36 add_library(${PROJECT_NAME}_lib ${SOURCES} ${PLATFORM})
37 target_compile_definitions(${PROJECT_NAME}_lib PRIVATE PF_SUPPORT_FP)
38
39 # Compile the same library but with an option for the static dictionary.
40 add_library(${PROJECT_NAME}_lib_sd STATIC ${SOURCES} ${PLATFORM})
41 target_compile_definitions(${PROJECT_NAME}_lib_sd PRIVATE PF_STATIC_DIC)
42 target_compile_definitions(${PROJECT_NAME}_lib_sd PRIVATE PF_SUPPORT_FP)