[llvm-dev] Extra space in LLVM_DEFINITIONS causes CMake 3.1 to fail

Mueller-Roemer, Johannes Sebastian via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 6 04:13:21 PDT 2015


The proper correction would probably be to use a list instead. As using a string with target_compile_definitions is not correct anyways. In any case, maybe we should instead use target_compile_definitions instead of add_llvm_definitions, it is supported by our minimum version: https://cmake.org/cmake/help/v2.8.12/cmake.html#command:target_compile_definitions


--
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

From: Paweł Bylica [mailto:chfast at gmail.com]
Sent: Tuesday, October 06, 2015 12:42
To: John Brawn; Mueller-Roemer, Johannes Sebastian
Cc: llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] Extra space in LLVM_DEFINITIONS causes CMake 3.1 to fail

I've fixed that: http://reviews.llvm.org/D13432

On Tue, Oct 6, 2015 at 12:06 PM John Brawn via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:
I made this change (not specifically changing from a list to a string, but changing from a hardcoded value to the value
that was actually decided by cmake), and I checked that it works with cmake 2.8.12.2 which is the minimum version
set in CMakeLists.txt. So if it doesn’t work with cmake 3.1/3.2 then that looks like something new that was introduced
after 2.8.12.2.

I’ll have a look at this to try and figure out what’s going on.

John

From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Mueller-Roemer, Johannes Sebastian via llvm-dev
Sent: 06 October 2015 08:50
To: llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
Subject: Re: [llvm-dev] Extra space in LLVM_DEFINITIONS causes CMake 3.1 to fail

Correction, I was accidentally testing with an old version for my CMake 3.2+ tests. They fail just the same with the current version.

--
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<mailto:johannes.mueller-roemer at igd.fraunhofer.de>  |  www.igd.fraunhofer.de<http://www.igd.fraunhofer.de>

From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Mueller-Roemer, Johannes Sebastian via llvm-dev
Sent: Tuesday, October 06, 2015 09:36
To: llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
Subject: [llvm-dev] Extra space in LLVM_DEFINITIONS causes CMake 3.1 to fail

LLVM_DEFINITIONS used to be defined as

set(LLVM_DEFINITIONS "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS")

Now it is defined as

set(LLVM_DEFINITIONS " -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS")

(note that it is no longer a cmake list but a string, and the string contains a leading space!)

This causes CMake 3.1 to emit

g++  -D -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS […]

when LLVM_DEFINITIONS is used via target_compile_definitions. Which, unsurprisingly, fails.

Although this issue is fixed in current CMake versions (3.2+), do we really want to require these versions just to have LLVM_DEFINITIONS defined as a string instead of a list? A simple check if LLVM_DEFINITIONS is empty in add_llvm_definitions might solve the issue.

--
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<mailto:johannes.mueller-roemer at igd.fraunhofer.de>  |  www.igd.fraunhofer.de<http://www.igd.fraunhofer.de>

_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151006/5e1c617a/attachment.html>


More information about the llvm-dev mailing list