[LLVMdev] CMake configuration: Detecting zlib.h header in windows.

sgundapa at codeaurora.org sgundapa at codeaurora.org
Fri Apr 11 11:19:49 PDT 2014


Thanks a lot for the reply Reid.
I guess you meant -DCMAKE_CXX_FLAGS/-DCMAKE_C_FLAGS.
Specifying -DCMAKE_<LANG>_FLAGS="/IC:\path\to\zlib\include" -DHAVE_LIBZ=1
-DCMAKE_EXE_LINKER_FLAGS="/IC:\path\to\zlib\lib\zlib.lib"
-DCMAKE_STATIC_LINKER_FLAGS="/IC:\path\to\zlib\lib\zlib.lib"
-DCMAKE_SHARED_LINKER_FLAGS="/IC:\path\to\zlib\lib\zlib.lib"


I know this is hacky(HAVE_LIBZ=1) but I am happy as long as things work
for me. The checks in cmake/config-ix.cmake to detect zlib library are
written purely for non-windows systems. I also see, in
lib/Support/CMakeLists.txt inclusion of zlib library is not intended for
MSVC.

--Sumanth G
> You can probably use -DCMAKE_CXX_COMPILER_FLAGS="/IC:\path\to\zlib".
>
>
> On Thu, Apr 10, 2014 at 2:31 PM, <sgundapa at codeaurora.org> wrote:
>
>> Hi,
>>    I have having hard time to let cmake configuration detect the zlib
>> header in windows with "Visual Studio 12" generator. My cmake
>> configuration goes like
>>
>>
>>  >> Set path, include and lib environment variables to point to zlib
>> headers and libraries. Cmake version is 2.8.12.2
>> cmake -G "Visual Studio 12" -D LLVM_TARGETS_TO_BUILD:STRING=%TARG% -D
>> TARGET_TRIPLE:STRING=%TRIPLE% -D
>> LLVM_DEFAULT_TARGET_TRIPLE:STRING=%TRIPLE% -D
>> LLVM_TARGET_ARCH:STRING=%TRIPLE% -D LLVM_ENABLE_PIC:BOOL=ON -D
>> LLVM_ENABLE_ASSERTIONS:BOOL=ON -D
>> CMAKE_INSTALL_PREFIX=%win_top_install_dir% -D CMAKE_BUILD_TYPE=%BLDMODE%
>> -DLLVM_APPEND_VC_REV:BOOL=ON -D LLVM_VENDOR_NAME:STRING=%NAME% -D
>> LLVM_VENDOR_VERSION:STRING=%VER% %win_top_src_dir%/llvm
>>
>>
>> As far as I know, cmake tries to compile a simple file with "#include
>> <zlib.h>" with MSbuild.exe which invokes a project file. MSbuild has its
>> own environment and ignores the user's environment variables.
>>
>> Any one face this issue before?
>> Let me know if you need more details on this.
>> The bottom line is , I want to set HAVE_ZLIB to 1
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>





More information about the llvm-dev mailing list