On 17 September 2014 15:47, Mueller-Roemer, Johannes Sebastian <Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de> wrote:> It's half the way there. Configuring and compiling works, but linking fails, probably some definition mismatches...It configured, compiled and linked okay for me. Could you look into it?> > But it can definitely be simplified, as due to the "REQUIRED" flag CMake will already fail if zlib isn't found, so no need for the > > if (ZLIB_FOUND) > ... > else() > message(FATAL_ERROR "zlib was requested but it could not be found") > endif() >Thanks. I'm aware that's what REQUIRED would do but I thought I'd try to be "defensive" just in case someone later on thinks removing "REQUIRED" is a good idea... If you think its unnecessary clutter I'd happily remove it.
Mueller-Roemer, Johannes Sebastian
2014-Sep-17 15:34 UTC
[LLVMdev] proposal to avoid zlib dependency.
I'll have another look tomorrow. IMO, it is unnecessary clutter. It will fail if ${ZLIB_LIBRARIES} or ${ZLIB_INCLUDE_DIRS} are used anyways as they will be set to NOTFOUND. Or we go back to a silent-fail solution: find_package(ZLIB QUIET) if (LLVM_ENABLE_ZLIB AND ZLIB_FOUND) set(HAVE_ZLIB_H 1) set(HAVE_LIBZ 1) list(APPEND CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES}) list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS}) else() set(HAVE_ZLIB_H 0) set(HAVE_LIBZ 0) endif() -- Johannes S. Mueller-Roemer, MSc Wiss. Mitarbeiter - Interactive Engineering Technologies (IET) Fraunhofer-Institut für Graphische Datenverarbeitung IGD Fraunhoferstr. 5 | 64283 Darmstadt | Germany Tel +49 6151 155-606 | Fax +49 6151 155-139 johannes.mueller-roemer at igd.fraunhofer.de | www.igd.fraunhofer.de -----Original Message----- From: Dan Liew [mailto:dan at su-root.co.uk] Sent: Wednesday, September 17, 2014 17:26 To: Mueller-Roemer, Johannes Sebastian Cc: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] proposal to avoid zlib dependency. On 17 September 2014 15:47, Mueller-Roemer, Johannes Sebastian <Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de> wrote:> It's half the way there. Configuring and compiling works, but linking fails, probably some definition mismatches...It configured, compiled and linked okay for me. Could you look into it?> > But it can definitely be simplified, as due to the "REQUIRED" flag > CMake will already fail if zlib isn't found, so no need for the > > if (ZLIB_FOUND) > ... > else() > message(FATAL_ERROR "zlib was requested but it could not be found") > endif() >Thanks. I'm aware that's what REQUIRED would do but I thought I'd try to be "defensive" just in case someone later on thinks removing "REQUIRED" is a good idea... If you think its unnecessary clutter I'd happily remove it.
On 17 September 2014 16:34, Mueller-Roemer, Johannes Sebastian <Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de> wrote:> I'll have another look tomorrow.Thanks.> IMO, it is unnecessary clutter. It will fail if ${ZLIB_LIBRARIES} or ${ZLIB_INCLUDE_DIRS} are used anyways as they will be set to NOTFOUND. Or we go back to a silent-fail solution:Fair enough. I've never been a big fan of silent failure. So perhaps just this... ``` if (LLVM_ENABLE_ZLIB ) find_package(ZLIB REQUIRED) set(HAVE_ZLIB_H 1) set(HAVE_LIBZ 1) list(APPEND CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES}) list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS}) else() set(HAVE_ZLIB_H 0) set(HAVE_LIBZ 0) endif() ``` -- Dan Liew PhD Student - Imperial College London
Maybe Matching Threads
- [LLVMdev] proposal to avoid zlib dependency.
- change in CMake variable names breaks existing uses and does not conform to CMake conventions
- [LLVMdev] r204593 breaks Asan tests on FreeBSD
- 2nd try: Lots of RPC-related compile errors (conflicting types, too many arguments, ...) trying to update Samba from 3.5 to 4.6
- [LLVMdev] r204593 breaks Asan tests on FreeBSD