[test-suite] r255239 - cmake: Add -lm flag for all programs in MultiSource

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 18:49:41 PST 2015


Hi Kristof,

I think we should keep the general cmake rules clean of this.

You should be able to add
    list(APPEND LDFLAGS -lm)
to MultiSource/CMakeLists.txt similar to SingleSource/CMakeLists.txt or even better only add the line in the subdirectories where it is really necessary.

(on a side note: I scanned through the existing Makefiles/CMakefiles and we seem to be adding a lot of superfluous flags. Example:
SingleSource/Makefile, SingleSource/Benchmarks/Makefile, SingleSource/Benchmarks/Shootout/Makefile all add -lm and we have three -lm flags at the end...
Maybe we can find the time during the cmake transition to clean some things like this up.)

- Matthias

> On Dec 10, 2015, at 2:26 AM, Kristof Beyls via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> Author: kbeyls
> Date: Thu Dec 10 04:26:44 2015
> New Revision: 255239
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=255239&view=rev
> Log:
> cmake: Add -lm flag for all programs in MultiSource
> 
> This makes the CMake-based build behave the same way as the Makefile-based
> build, and makes the CMake-based build work on linux.
> 
> 
> Modified:
>    test-suite/trunk/cmake/modules/SingleMultiSource.cmake
> 
> Modified: test-suite/trunk/cmake/modules/SingleMultiSource.cmake
> URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/modules/SingleMultiSource.cmake?rev=255239&r1=255238&r2=255239&view=diff
> ==============================================================================
> --- test-suite/trunk/cmake/modules/SingleMultiSource.cmake (original)
> +++ test-suite/trunk/cmake/modules/SingleMultiSource.cmake Thu Dec 10 04:26:44 2015
> @@ -180,6 +180,7 @@ macro(llvm_multisource)
>     append_cflags(${source_exename} CPPFLAGS)
>     append_cflags(${source_exename} CXXFLAGS)
>     append_ldflags(${source_exename} LDFLAGS)
> +    target_link_libraries(${source_exename} -lm)
>     llvm_add_test(${PROG} ${source_exename})
>     add_dependencies(${source_exename} timeit fpcmp)
>   endif()
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list