FindM.cmake: directly pass -lm to fix selective static linking
authorPeter Wu <peter@lekensteyn.nl>
Thu, 18 Oct 2018 17:50:04 +0000 (19:50 +0200)
committerAnders Broman <a.broman58@gmail.com>
Thu, 18 Oct 2018 20:06:49 +0000 (20:06 +0000)
When CMAKE_FIND_LIBRARY_SUFFIXES is set to ".a" (in order to find only
static libraries), executables would be linked with libm.a. This fails
when the C runtime is not statically linked as well:
https://bugzilla.redhat.com/show_bug.cgi?id=1433347

Change-Id: I1480607bd3d0678661694657a2709ee1c56f9530
Reviewed-on: https://code.wireshark.org/review/30253
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
cmake/modules/FindM.cmake

index 2fb542935337acddb4b0647bbbeb00589aa34b9b..402a8bce8a5df91ef2ef3ba1fcb14a8cf3f160b2 100644 (file)
@@ -34,8 +34,7 @@ SET(CMAKE_FIND_FRAMEWORK LAST)
 FIND_PATH(M_INCLUDE_DIR math.h)
 SET(CMAKE_FIND_FRAMEWORK ${SAVED_CMAKE_FIND_FRAMEWORK})
 
-SET(M_NAMES m)
-FIND_LIBRARY(M_LIBRARY NAMES ${M_NAMES} )
+set(M_LIBRARY m)
 
 # handle the QUIETLY and REQUIRED arguments and set M_FOUND to TRUE if 
 # all listed variables are TRUE