xref: /reactos/sdk/tools/mkisofs/CMakeLists.txt (revision 2d4c0b87)
1
2add_definitions(
3    -DDUPLICATES_ONCE
4    -DINS_BASE="\\\".\\\""
5    -DSCHILY_BUILD
6    -DSORTING)
7
8include_directories(
9    schilytools/include
10    reactos
11    ${REACTOS_BINARY_DIR}/sdk/include)
12
13# libschily and libsiconv are licensed under CDDL whereas mkisofs is licensed under GPL.
14# As such, we cannot mix the library sources with mkisofs sources and have to build them separately.
15# Later on, they may still be linked together though.
16#
17# Reference: http://opensource.stackexchange.com/questions/2094
18
19add_library(libmdigest
20    schilytools/libmdigest/sha3.c)
21
22add_library(libschily
23    schilytools/libschily/stdio/cvmod.c
24    schilytools/libschily/stdio/dat.c
25    schilytools/libschily/stdio/fcons.c
26    schilytools/libschily/stdio/ffileread.c
27    schilytools/libschily/stdio/fgetline.c
28    schilytools/libschily/stdio/fileopen.c
29    schilytools/libschily/stdio/filewrite.c
30    schilytools/libschily/stdio/flag.c
31    schilytools/libschily/stdio/niwrite.c
32    schilytools/libschily/astoll.c
33    schilytools/libschily/checkerr.c
34    schilytools/libschily/comerr.c
35    schilytools/libschily/dirent.c
36    schilytools/libschily/eaccess.c
37    schilytools/libschily/error.c
38    schilytools/libschily/fconv.c
39    schilytools/libschily/fillbytes.c
40    schilytools/libschily/fnmatch.c
41    schilytools/libschily/format.c
42    schilytools/libschily/getargs.c
43    schilytools/libschily/geterrno.c
44    schilytools/libschily/getexecpath.c
45    schilytools/libschily/gettimeofday.c
46    schilytools/libschily/gid.c
47    schilytools/libschily/jsprintf.c
48    schilytools/libschily/jssnprintf.c
49    schilytools/libschily/match.c
50    schilytools/libschily/mem.c
51    schilytools/libschily/movebytes.c
52    schilytools/libschily/raisecond.c
53    schilytools/libschily/saveargs.c
54    schilytools/libschily/searchinpath.c
55    schilytools/libschily/seterrno.c
56    schilytools/libschily/streql.c
57    schilytools/libschily/strlcat.c
58    schilytools/libschily/strlcpy.c
59    schilytools/libschily/uid.c
60    schilytools/libschily/zerobytes.c)
61
62add_library(libsiconv
63    schilytools/libsiconv/sic_nls.c)
64target_link_libraries(libsiconv libschily)
65
66add_host_tool(mkisofs
67    schilytools/mkisofs/boot.c
68    schilytools/mkisofs/eltorito.c
69    schilytools/mkisofs/hash.c
70    schilytools/mkisofs/inode.c
71    schilytools/mkisofs/isonum.c
72    schilytools/mkisofs/joliet.c
73    schilytools/mkisofs/match.c
74    schilytools/mkisofs/mkisofs.c
75    schilytools/mkisofs/multi.c
76    schilytools/mkisofs/name.c
77    schilytools/mkisofs/rock.c
78    schilytools/mkisofs/stream.c
79    schilytools/mkisofs/tree.c
80    schilytools/mkisofs/write.c)
81target_link_libraries(mkisofs libmdigest libschily libsiconv)
82
83if(MSVC)
84    # mkisofs uses K&R-style function definitions to support very old compilers.
85    # MSVC complains about the resulting foo() vs. foo(void) mismatches.
86    target_compile_options(mkisofs PRIVATE "/wd4113")
87
88    if(ARCH STREQUAL "amd64")
89        # Disable warning "conversion from 'size_t' to 'int', possible loss of data"
90        target_compile_options(mkisofs PRIVATE "/wd4267")
91
92        # Disable warning "'type cast': pointer truncation from 'const char *' to 'long'"
93        target_compile_options(libschily PRIVATE "/wd4311")
94    endif()
95
96    # Disable warning "'<': signed/unsigned mismatch"
97    target_compile_options(mkisofs PRIVATE "/wd4018")
98
99    # Disable warning "'nchar': unreferenced local variable"
100    target_compile_options(mkisofs PRIVATE "/wd4101")
101
102    # Disable warning "'+=': conversion from 'x' to 'y', possible loss of data"
103    target_compile_options(libschily PRIVATE "/wd4244")
104    target_compile_options(mkisofs PRIVATE "/wd4244")
105else()
106    # libschily implements an own printf function with support for the %r formatter.
107    # Silence compilers checking for invalid formatting sequences.
108    target_compile_options(libschily PRIVATE "-Wno-format")
109
110    # MATCHES must be used here because on macOS, CMake uses the compiler ID "AppleClang".
111    if(CMAKE_C_COMPILER_ID MATCHES "Clang$" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "15")
112        # mkisofs uses K&R-style function definitions to support very old compilers.
113        # This causes warnings with modern compilers.
114        target_compile_options(libmdigest PRIVATE "-Wno-deprecated-non-prototype")
115        target_compile_options(libschily PRIVATE "-Wno-deprecated-non-prototype")
116        target_compile_options(libsiconv PRIVATE "-Wno-deprecated-non-prototype")
117        target_compile_options(mkisofs PRIVATE "-Wno-deprecated-non-prototype")
118    endif()
119endif()
120