mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-02 20:58:58 -06:00
Tutorial: Update Step 5 to work on Windows
`log` and `exp` should be found on Windows systems now, as expected. Update tests to be more specific in looking for the expected outcome of the tutorial.
This commit is contained in:
@@ -8,10 +8,20 @@ target_include_directories(MathFunctions
|
||||
|
||||
# does this system provide the log and exp functions?
|
||||
include(CheckSymbolExists)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "m")
|
||||
check_symbol_exists(log "math.h" HAVE_LOG)
|
||||
check_symbol_exists(exp "math.h" HAVE_EXP)
|
||||
if(NOT (HAVE_LOG AND HAVE_EXP))
|
||||
unset(HAVE_LOG CACHE)
|
||||
unset(HAVE_EXP CACHE)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "m")
|
||||
check_symbol_exists(log "math.h" HAVE_LOG)
|
||||
check_symbol_exists(exp "math.h" HAVE_EXP)
|
||||
if(HAVE_LOG AND HAVE_EXP)
|
||||
target_link_libraries(MathFunctions PRIVATE m)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# add compile definitions
|
||||
if(HAVE_LOG AND HAVE_EXP)
|
||||
target_compile_definitions(MathFunctions
|
||||
PRIVATE "HAVE_LOG" "HAVE_EXP")
|
||||
|
||||
Reference in New Issue
Block a user