Anonymous avatar Anonymous committed 32bea5f

Add some code to find the libm.

Comments (0)

Files changed (3)

         DEPENDS ${DEST}
     )
 ENDMACRO(RUN_POD2MAN)
+
+
+# Finds libm and puts the result in the MATH_LIB_LIST variable.
+# If it cannot find it, it fails with an error.
+MACRO(FIND_LIBM)
+    IF (UNIX)
+        FIND_LIBRARY(LIBM_LIB m)
+        IF(LIBM_LIB STREQUAL "LIBM_LIB-NOTFOUND")
+            MESSAGE(FATAL_ERROR "Cannot find libm")
+        ELSE(LIBM_LIB STREQUAL "LIBM_LIB-NOTFOUND")
+            SET(MATH_LIB_LIST ${LIBM_LIB})
+        ENDIF(LIBM_LIB STREQUAL "LIBM_LIB-NOTFOUND")
+    ELSE(UNIX)
+        SET(MATH_LIB_LIST)
+    ENDIF(UNIX)
+ENDMACRO(FIND_LIBM)
+
+

src/wml_backend/p2_mp4h/src/CMakeLists.txt

 # TODO - replace ".." by the fully qualified path.
 INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../pcre ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../lib ${CMAKE_CURRENT_SOURCE_DIR})
 
-
 ########### next target ###############
 
 SET(mp4h_SRCS
 
 ADD_EXECUTABLE(mp4h ${mp4h_SRCS})
 
-TARGET_LINK_LIBRARIES(mp4h m mp4h_lib pcre )
+FIND_LIBRARY(LIBPCRE_LIB pcre)
+
+FIND_LIBM()
+
+TARGET_LINK_LIBRARIES(mp4h ${MATH_LIB_LIST} ${LIBPCRE_LIB})
 
 INSTALL( TARGETS mp4h DESTINATION bin)

src/wml_backend/p4_gm4/src/CMakeLists.txt

    symtab.c
    )
 
+FIND_LIBM()
+
 ADD_EXECUTABLE(m4 ${m4_SRCS})
 
-TARGET_LINK_LIBRARIES( m4 m m4_lib )
+TARGET_LINK_LIBRARIES( m4 ${MATH_LIB_LIST} m4_lib )
 
 INSTALL( TARGETS m4 DESTINATION bin)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.