mirror of
https://github.com/google/brotli.git
synced 2024-11-08 13:20:05 +00:00
simplify log2 check; currently we rely more on compiler than build system
PiperOrigin-RevId: 598794971
This commit is contained in:
parent
02458f3443
commit
adbc354d23
@ -78,27 +78,12 @@ if (ENABLE_SANITIZER)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
|
||||
endif ()
|
||||
|
||||
include(CheckFunctionExists)
|
||||
include(CheckLibraryExists)
|
||||
set(LIBM_LIBRARY)
|
||||
CHECK_FUNCTION_EXISTS(log2 LOG2_RES)
|
||||
if(NOT LOG2_RES)
|
||||
set(_ORIG_REQ_LIBS "${CMAKE_REQUIRED_LIBRARIES}")
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};m")
|
||||
CHECK_FUNCTION_EXISTS(log2 LOG2_LIBM_RES)
|
||||
if(LOG2_LIBM_RES)
|
||||
set(LIBM_LIBRARY "m")
|
||||
add_definitions(-DBROTLI_HAVE_LOG2=1)
|
||||
else()
|
||||
add_definitions(-DBROTLI_HAVE_LOG2=0)
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${_ORIG_REQ_LIBS}")
|
||||
unset(LOG2_LIBM_RES)
|
||||
unset(_ORIG_REQ_LIBS)
|
||||
else()
|
||||
add_definitions(-DBROTLI_HAVE_LOG2=1)
|
||||
CHECK_LIBRARY_EXISTS(m log2 "" HAVE_LIB_M)
|
||||
if(HAVE_LIB_M)
|
||||
set(LIBM_LIBRARY "m")
|
||||
endif()
|
||||
unset(LOG2_RES)
|
||||
|
||||
set(BROTLI_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/c/include")
|
||||
mark_as_advanced(BROTLI_INCLUDE_DIRS)
|
||||
|
Loading…
Reference in New Issue
Block a user