I am trying to build zlib on windows as a dependency in my cmake project.
I have come up with the following which works fine:
file(WRITE ${CMAKE_BINARY_DIR}/zlib.nmake
AS=ml64\n
LOC="-DASMV -DASMINF -DNDEBUG -I."\n
OBJA="inffasx64.obj gvmat64.obj inffas8664.obj"\n
-f win32/Makefile.msc\n
zlib.lib\n)
ExternalProject_Add(
zlib
GIT_REPOSITORY https://github.com/kyotov/zlib.git
GIT_TAG mt
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> nmake @${CMAKE_BINARY_DIR}/zlib.nmake
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/zlib.h <INSTALL_DIR>/install/include/zlib.h
COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/zconf.h <INSTALL_DIR>/install/include/zconf.h
COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/zlib.lib <INSTALL_DIR>/install/lib/zlib.lib
COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/zlib.pdb <INSTALL_DIR>/install/lib/zlib.pdb
)
I would really prefer if I can inline the call to nmake and not have to resort to passing @ parameter.
I spent about 15-30 minutes trying to escape the double quotes in various ways but could not get it done.
Google did not teach me anything either...
Anybody has any smart ideas?