diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-10-28 10:44:20 -0400 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-10-28 10:44:20 -0400 |
commit | bd249d11216a32c1ba73c02edc91ab770bbd556c (patch) | |
tree | c8c77b8108c5b604eb6706783af7625d01a7326d /cmake/EigenTesting.cmake | |
parent | 868f753d10b989e62152eb95f2a404b8be063a23 (diff) |
fix bug #92 - we were doing stupid things when passing the list of libraries to link to.
Diffstat (limited to 'cmake/EigenTesting.cmake')
-rw-r--r-- | cmake/EigenTesting.cmake | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/cmake/EigenTesting.cmake b/cmake/EigenTesting.cmake index 1637989ad..821bdae56 100644 --- a/cmake/EigenTesting.cmake +++ b/cmake/EigenTesting.cmake @@ -37,13 +37,16 @@ macro(ei_add_test_internal testname testname_with_suffix) endif() if(${ARGC} GREATER 3) - foreach(lib_to_link ${ARGV3}) - string(STRIP "${lib_to_link}" lib_to_link_stripped) - string(LENGTH "${lib_to_link_stripped}" lib_to_link_stripped_length) - if(${lib_to_link_stripped_length} GREATER 0) - target_link_libraries(${targetname} "${lib_to_link}") - endif() - endforeach() + set(libs_to_link ${ARGV3}) + # it could be that some cmake module provides a bad library string " " (just spaces), + # and that severely breaks target_link_libraries ("can't link to -l-lstdc++" errors). + # so we check for strings containing only spaces. + string(STRIP "${libs_to_link}" libs_to_link_stripped) + string(LENGTH "${libs_to_link_stripped}" libs_to_link_stripped_length) + if(${libs_to_link_stripped_length} GREATER 0) + # notice: no double quotes around ${libs_to_link} here. It may be a list. + target_link_libraries(${targetname} ${libs_to_link}) + endif() endif() if(WIN32) |