mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-31 19:04:27 +02:00
build: range-v3 dependency added to CMake config file for clang + libc++
This commit is contained in:
@@ -20,8 +20,35 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
function(__check_libcxx_in_use variable)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
message(CHECK_START "Checking if libc++ is being used")
|
||||
list(APPEND CMAKE_MESSAGE_INDENT " ")
|
||||
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(_LIBCPP_VERSION "ciso646" ${variable})
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
|
||||
list(POP_BACK CMAKE_MESSAGE_INDENT)
|
||||
if(UNITS_LIBCXX)
|
||||
message(CHECK_PASS "found")
|
||||
else()
|
||||
message(CHECK_FAIL "not found")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(fmt)
|
||||
find_dependency(gsl-lite)
|
||||
|
||||
# add range-v3 dependency only for clang + libc++
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
__check_libcxx_in_use(__units_libcxx)
|
||||
if(__units_libcxx)
|
||||
find_dependency(range-v3)
|
||||
endif()
|
||||
unset(__units_libcxx)
|
||||
endif()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/mp-unitsTargets.cmake")
|
||||
|
Reference in New Issue
Block a user