build: range-v3 dependency added to CMake config file for clang + libc++

This commit is contained in:
Mateusz Pusz
2021-03-19 11:08:50 +01:00
parent 03fe0d5b27
commit ec4c283cc0

View File

@@ -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")