-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
Hi.
Line 86 of cmakelists is:
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
However, it does not do what it is actually supposed to do.
CMAKE_SOURCE_DIR is "The path to the top level of the source tree."
While clearly, you want the path to the current src dir, i.e. CMAKE_CURRENT_SOURCE_DIR, like it happens in MSVC case.
The difference is, this way, if zlib is used in another project via add_subdirectory(), it actually uses it's own zlib.h, not the system one:
$ cmake --build ./ -- -j1
[1/84] Building C object zlib/zlib-build/CMakeFiles/minigzip.dir/test/minigzip.o
FAILED: zlib/zlib-build/CMakeFiles/minigzip.dir/test/minigzip.o
/usr/bin/cc -DDEBUG -DHAVE_JPEG -D_LARGEFILE64_SOURCE=1 -Izlib/zlib-build -I../ -w -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-common -U_FORTIFY_SOURCE -fsanitize=address -fstack-protector-strong -fPIE -march=native -g3 -ggdb3 -Werror -MD -MT zlib/zlib-build/CMakeFiles/minigzip.dir/test/minigzip.o -MF zlib/zlib-build/CMakeFiles/minigzip.dir/test/minigzip.o.d -o zlib/zlib-build/CMakeFiles/minigzip.dir/test/minigzip.o -c /home/lebedevri/rawspeed/build/zlib/zlib-src/test/minigzip.c
In file included from /home/lebedevri/rawspeed/build/zlib/zlib-src/test/minigzip.c:18:0:
/usr/include/zlib.h:30:1: error: expected identifier or ‘(’ before numeric constant
212121
^~~~~~
In file included from /usr/include/zlib.h:34:0,
from /home/lebedevri/rawspeed/build/zlib/zlib-src/test/minigzip.c:18:
/usr/include/zconf.h:377:12: error: unknown type name ‘Byte’
typedef Byte FAR Bytef;
^~~~
ninja: build stopped: subcommand failed.
(i added 212121 to /usr/include/zlib.h to illustrate the point.)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels