mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
check if math library is available and include if present
This commit is contained in:
parent
9165932928
commit
b1e1923580
@ -46,6 +46,8 @@ if(MSVC)
|
|||||||
add_compile_options(/Za)
|
add_compile_options(/Za)
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
|
find_library(MATH_LIBRARY m)
|
||||||
|
|
||||||
add_subdirectory(conversions)
|
add_subdirectory(conversions)
|
||||||
add_subdirectory(misc)
|
add_subdirectory(misc)
|
||||||
add_subdirectory(project_euler)
|
add_subdirectory(project_euler)
|
||||||
|
@ -16,12 +16,9 @@ foreach( testsourcefile ${APP_SOURCES} )
|
|||||||
if(OpenMP_C_FOUND)
|
if(OpenMP_C_FOUND)
|
||||||
target_link_libraries(${testname} OpenMP::OpenMP_C)
|
target_link_libraries(${testname} OpenMP::OpenMP_C)
|
||||||
endif()
|
endif()
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
if(MATH_LIBRARY)
|
||||||
target_link_libraries(${testname} m)
|
target_link_libraries(${testname} ${MATH_LIBRARY})
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
||||||
target_link_libraries(${testname} m)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS ${testname} DESTINATION "bin/conversions")
|
install(TARGETS ${testname} DESTINATION "bin/conversions")
|
||||||
|
|
||||||
endforeach( testsourcefile ${APP_SOURCES} )
|
endforeach( testsourcefile ${APP_SOURCES} )
|
||||||
|
@ -16,10 +16,8 @@ foreach( testsourcefile ${APP_SOURCES} )
|
|||||||
if(OpenMP_C_FOUND)
|
if(OpenMP_C_FOUND)
|
||||||
target_link_libraries(${testname} OpenMP::OpenMP_C)
|
target_link_libraries(${testname} OpenMP::OpenMP_C)
|
||||||
endif()
|
endif()
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
if(MATH_LIBRARY)
|
||||||
target_link_libraries(${testname} m)
|
target_link_libraries(${testname} ${MATH_LIBRARY})
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
||||||
target_link_libraries(${testname} m)
|
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS ${testname} DESTINATION "bin/misc")
|
install(TARGETS ${testname} DESTINATION "bin/misc")
|
||||||
|
|
||||||
|
@ -24,10 +24,9 @@ foreach( testsourcefile ${APP_SOURCES} )
|
|||||||
if(OpenMP_C_FOUND)
|
if(OpenMP_C_FOUND)
|
||||||
target_link_libraries(${testname} OpenMP::OpenMP_C)
|
target_link_libraries(${testname} OpenMP::OpenMP_C)
|
||||||
endif()
|
endif()
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|
||||||
target_link_libraries(${testname} m)
|
if(MATH_LIBRARY)
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
target_link_libraries(${testname} ${MATH_LIBRARY})
|
||||||
target_link_libraries(${testname} m)
|
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS ${testname} DESTINATION "bin/numerical_methods")
|
install(TARGETS ${testname} DESTINATION "bin/numerical_methods")
|
||||||
|
|
||||||
|
@ -19,10 +19,9 @@ foreach( testsourcefile ${APP_SOURCES} )
|
|||||||
if(OpenMP_C_FOUND)
|
if(OpenMP_C_FOUND)
|
||||||
target_link_libraries(${testname} OpenMP::OpenMP_C)
|
target_link_libraries(${testname} OpenMP::OpenMP_C)
|
||||||
endif()
|
endif()
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|
||||||
target_link_libraries(${testname} m)
|
if(MATH_LIBRARY)
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
target_link_libraries(${testname} ${MATH_LIBRARY})
|
||||||
target_link_libraries(${testname} m)
|
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS ${testname} DESTINATION "bin/misc")
|
install(TARGETS ${testname} DESTINATION "bin/misc")
|
||||||
|
|
||||||
|
@ -16,10 +16,8 @@ foreach( testsourcefile ${APP_SOURCES} )
|
|||||||
if(OpenMP_C_FOUND)
|
if(OpenMP_C_FOUND)
|
||||||
target_link_libraries(${testname} OpenMP::OpenMP_C)
|
target_link_libraries(${testname} OpenMP::OpenMP_C)
|
||||||
endif()
|
endif()
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
if(MATH_LIBRARY)
|
||||||
target_link_libraries(${testname} m)
|
target_link_libraries(${testname} ${MATH_LIBRARY})
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
||||||
target_link_libraries(${testname} m)
|
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS ${testname} DESTINATION "bin/searching")
|
install(TARGETS ${testname} DESTINATION "bin/searching")
|
||||||
|
|
||||||
|
@ -16,10 +16,8 @@ foreach( testsourcefile ${APP_SOURCES} )
|
|||||||
if(OpenMP_C_FOUND)
|
if(OpenMP_C_FOUND)
|
||||||
target_link_libraries(${testname} OpenMP::OpenMP_C)
|
target_link_libraries(${testname} OpenMP::OpenMP_C)
|
||||||
endif()
|
endif()
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
if(MATH_LIBRARY)
|
||||||
target_link_libraries(${testname} m)
|
target_link_libraries(${testname} ${MATH_LIBRARY})
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
||||||
target_link_libraries(${testname} m)
|
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS ${testname} DESTINATION "bin/sorting")
|
install(TARGETS ${testname} DESTINATION "bin/sorting")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user