HaveF / include-what-you-use

Automatically exported from code.google.com/p/include-what-you-use
Other
0 stars 0 forks source link

CMakeLists is not FreeBSD-compatible #134

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Check out IWYU in-tree on FreeBSD
2. Run cmake -G Ninja

What is the expected output? What do you see instead?

Successful build. The build fails because it cannot find 'dl' on FreeBSD. 
Dynamic linking is part of FreeBSD's libc, so dl should not be necessary.

See attached patch for a suggested fix. This should work on the Mac too, right?

Original issue reported on code.google.com by kim.gras...@gmail.com on 27 May 2014 at 8:31

Attachments:

GoogleCodeExporter commented 9 years ago
On Mac OS X after removing 'dl' from CMakeLists.txt IWYU is built and linked 
fine.  Both in-tree and out-of-tree (for 3.4) configurations.

What if bring 'dl' in 'Platform dependencies' block?  For example,

    if WIN32:
      shlwapi
    else:
      if LINUX:
        dl
      pthread
      curses

I am not sure if it's better, just an idea.

Original comment by vsap...@gmail.com on 29 May 2014 at 4:45

GoogleCodeExporter commented 9 years ago
Sorry, I don't understand what you're saying...?

I thought this is what the patch does, but you seem to mean something else.

Original comment by kim.gras...@gmail.com on 29 May 2014 at 7:16

GoogleCodeExporter commented 9 years ago
You are right, my mistake.  I somehow understood your patch as "if(LINUX)" part 
is after "if(WIN32)else()endif()".

Original comment by vsap...@gmail.com on 29 May 2014 at 7:22

GoogleCodeExporter commented 9 years ago
Ah, I see.

It's a shame the platform checks are so inconsistent, I'll look into using the 
same CMake mechanism for checking both of them, maybe it becomes clearer.

There's no LINUX symbol defined, so it looks like the most consistent is to use 
CMAKE_SYSTEM_NAME.

Original comment by kim.gras...@gmail.com on 29 May 2014 at 7:27

GoogleCodeExporter commented 9 years ago
Fixed in r548.

Original comment by kim.gras...@gmail.com on 29 May 2014 at 7:57

GoogleCodeExporter commented 9 years ago
I forgot to mention that we require no changes in Makefile.  I prefer to state 
it explicitly to avoid impression that we've just forgotten about Makefile.

'dl' in CMakeLists.txt is needed because we use add_executable instead of 
add_clang_executable.  And we use add_executable to support out-of-tree build.  
Such build isn't supported by Makefile, so no worries about 'dl' in Makefile.

Original comment by vsap...@gmail.com on 29 May 2014 at 10:44