force include math library for each target

This commit is contained in:
Krishna Vedala 2020-05-29 13:49:28 -04:00
parent e7b4a8c522
commit d4f202cbea
7 changed files with 30 additions and 9 deletions

View File

@ -46,12 +46,6 @@ if(MSVC)
add_compile_options(/Za)
endif(MSVC)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
link_libraries(m)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
link_libraries(m)
endif()
add_subdirectory(conversions)
add_subdirectory(misc)
add_subdirectory(project_euler)

View File

@ -16,7 +16,11 @@ foreach( testsourcefile ${APP_SOURCES} )
if(OpenMP_C_FOUND)
target_link_libraries(${testname} OpenMP::OpenMP_C)
endif()
target_link_libraries(${testname} m)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_libraries(${testname} m)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(${testname} m)
endif()
install(TARGETS ${testname} DESTINATION "bin/conversions")

View File

@ -16,6 +16,11 @@ foreach( testsourcefile ${APP_SOURCES} )
if(OpenMP_C_FOUND)
target_link_libraries(${testname} OpenMP::OpenMP_C)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_libraries(${testname} m)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(${testname} m)
endif()
install(TARGETS ${testname} DESTINATION "bin/misc")
endforeach( testsourcefile ${APP_SOURCES} )

View File

@ -24,7 +24,11 @@ foreach( testsourcefile ${APP_SOURCES} )
if(OpenMP_C_FOUND)
target_link_libraries(${testname} OpenMP::OpenMP_C)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_libraries(${testname} m)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(${testname} m)
endif()
install(TARGETS ${testname} DESTINATION "bin/numerical_methods")
endforeach( testsourcefile ${APP_SOURCES} )

View File

@ -19,7 +19,11 @@ foreach( testsourcefile ${APP_SOURCES} )
if(OpenMP_C_FOUND)
target_link_libraries(${testname} OpenMP::OpenMP_C)
endif()
set_target_properties(${testname} PROPERTIES LINKER_LANGUAGE C)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_libraries(${testname} m)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(${testname} m)
endif()
install(TARGETS ${testname} DESTINATION "bin/misc")
endforeach( testsourcefile ${APP_SOURCES} )

View File

@ -16,6 +16,11 @@ foreach( testsourcefile ${APP_SOURCES} )
if(OpenMP_C_FOUND)
target_link_libraries(${testname} OpenMP::OpenMP_C)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_libraries(${testname} m)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(${testname} m)
endif()
install(TARGETS ${testname} DESTINATION "bin/searching")
endforeach( testsourcefile ${APP_SOURCES} )

View File

@ -16,6 +16,11 @@ foreach( testsourcefile ${APP_SOURCES} )
if(OpenMP_C_FOUND)
target_link_libraries(${testname} OpenMP::OpenMP_C)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_libraries(${testname} m)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(${testname} m)
endif()
install(TARGETS ${testname} DESTINATION "bin/sorting")
endforeach( testsourcefile ${APP_SOURCES} )