mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-13 20:26:03 +08:00
Fix parsing of command-line arguments when already specified as a cmake list.
(cherry picked from commit 555cec17edc2cae91b3310ef8915acbeb3951cab)
This commit is contained in:
parent
99473f255b
commit
63e8b31c94
@ -88,6 +88,20 @@ else()
|
||||
ei_add_cxx_compiler_flag("-std=c++03")
|
||||
endif()
|
||||
|
||||
function(ei_maybe_separate_arguments variable mode args)
|
||||
# Use separate_arguments if the input is a single string containing a space.
|
||||
# Otherwise, if it is already a list or doesn't have a space, just propagate
|
||||
# the original value. This is to better support multi-argument lists.
|
||||
list(LENGTH args list_length)
|
||||
if (${list_length} EQUAL 1)
|
||||
string(FIND "${args}" " " has_space)
|
||||
if (${has_space} GREATER -1)
|
||||
separate_arguments(args ${mode} "${args}")
|
||||
endif()
|
||||
endif()
|
||||
set(${variable} ${args} PARENT_SCOPE)
|
||||
endfunction(ei_maybe_separate_arguments)
|
||||
|
||||
# Determine if we should build shared libraries on this platform.
|
||||
get_cmake_property(EIGEN_BUILD_SHARED_LIBS TARGET_SUPPORTS_SHARED_LIBS)
|
||||
|
||||
@ -101,6 +115,10 @@ find_package(StandardMathLibrary)
|
||||
set(EIGEN_TEST_CUSTOM_LINKER_FLAGS "" CACHE STRING "Additional linker flags when linking unit tests.")
|
||||
set(EIGEN_TEST_CUSTOM_CXX_FLAGS "" CACHE STRING "Additional compiler flags when compiling unit tests.")
|
||||
|
||||
# Convert space-separated arguments into CMake lists for downstream consumption.
|
||||
ei_maybe_separate_arguments(EIGEN_TEST_CUSTOM_LINKER_FLAGS NATIVE_COMMAND "${EIGEN_TEST_CUSTOM_LINKER_FLAGS}")
|
||||
ei_maybe_separate_arguments(EIGEN_TEST_CUSTOM_CXX_FLAGS NATIVE_COMMAND "${EIGEN_TEST_CUSTOM_CXX_FLAGS}")
|
||||
|
||||
set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "")
|
||||
|
||||
if(NOT STANDARD_MATH_LIBRARY_FOUND)
|
||||
|
@ -83,7 +83,7 @@ macro(ei_add_test_internal testname testname_with_suffix)
|
||||
endif()
|
||||
|
||||
if(EIGEN_TEST_CUSTOM_CXX_FLAGS)
|
||||
ei_add_target_property(${targetname} COMPILE_FLAGS "${EIGEN_TEST_CUSTOM_CXX_FLAGS}")
|
||||
ei_add_target_property(${targetname} COMPILE_FLAGS ${EIGEN_TEST_CUSTOM_CXX_FLAGS})
|
||||
endif()
|
||||
|
||||
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
||||
|
Loading…
x
Reference in New Issue
Block a user