3 # Find the native M includes and library
5 # M_INCLUDE_DIRS - where to find math.h, etc.
6 # M_LIBRARIES - List of libraries when using math.
7 # M_FOUND - True if math found.
11 # Already in cache, be silent
12 SET(M_FIND_QUIETLY TRUE)
13 ENDIF (M_INCLUDE_DIRS)
16 # On macOS, make sure we do *NOT* find math.h in the Kernel framework,
17 # as that will convince CMake to cause the build to look there for
20 # For some unknown reason, on Yosemite, math.h is included in the Kernel
21 # framework. That framework exists to supply headers for building
22 # *kernel* modules; it includes versions of C headers that are similar
23 # to the standard userland headers, but not similar enough to be usable
24 # when building userland code.
26 # Unless told not to look first in the framework paths, CMake will, on
27 # Yosemite, or when using the Yosemite SDK, find math.h in the Kernel
28 # framework, and add the header directory for the Kernel framework to
29 # the list of places to look for headers, causing it to pick up other
30 # headers from there as well. This causes the build to fail.
32 SET(SAVED_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
33 SET(CMAKE_FIND_FRAMEWORK LAST)
34 FIND_PATH(M_INCLUDE_DIR math.h)
35 SET(CMAKE_FIND_FRAMEWORK ${SAVED_CMAKE_FIND_FRAMEWORK})
39 # handle the QUIETLY and REQUIRED arguments and set M_FOUND to TRUE if
40 # all listed variables are TRUE
41 INCLUDE(FindPackageHandleStandardArgs)
42 FIND_PACKAGE_HANDLE_STANDARD_ARGS(M DEFAULT_MSG M_LIBRARY M_INCLUDE_DIR)
45 SET( M_LIBRARIES ${M_LIBRARY} )
46 SET( M_INCLUDE_DIRS ${M_INCLUDE_DIR} )
52 MARK_AS_ADVANCED( M_LIBRARIES M_INCLUDE_DIRS )