|
From: <kin...@us...> - 2025-09-10 02:06:08
|
Revision: 7392
http://sourceforge.net/p/teem/code/7392
Author: kindlmann
Date: 2025-09-10 02:06:04 +0000 (Wed, 10 Sep 2025)
Log Message:
-----------
now the library type of the mini sub-project test library follows BUILD_SHARED_LIBS
Modified Paths:
--------------
teem/trunk/CMake/CheckLibM.cmake
Modified: teem/trunk/CMake/CheckLibM.cmake
===================================================================
--- teem/trunk/CMake/CheckLibM.cmake 2025-09-10 01:34:21 UTC (rev 7391)
+++ teem/trunk/CMake/CheckLibM.cmake 2025-09-10 02:06:04 UTC (rev 7392)
@@ -33,7 +33,13 @@
return()
endif()
-set(_lmn_desc "Need to explicitly link with -lm?")
+if(BUILD_SHARED_LIBS)
+ set(_lib_type SHARED)
+else()
+ set(_lib_type STATIC)
+endif()
+
+set(_lmn_desc "Need to add -lm when linking with math-using ${_lib_type} lib?")
message(STATUS "CheckLibM: ${_lmn_desc}")
set(_checklibm_dir "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/tmpCheckLibM")
@@ -74,7 +80,9 @@
project(CheckLibM_${suffix} C)
set(CMAKE_VERBOSE_MAKEFILE OFF)
-add_library(tiny SHARED \"${_checklibm_dir}/tiny.c\")
+# Create libtiny is shared or static, according to BUILD_SHARED_LIBS
+add_library(tiny ${_lib_type} \"${_checklibm_dir}/tiny.c\")
+# Make maintiny link only with tiny and optional extra_libs
add_executable(maintiny \"${_checklibm_dir}/maintiny.c\")
target_link_libraries(maintiny PRIVATE tiny ${extra_libs})
")
@@ -124,7 +132,7 @@
if(_checklibm_no_libm_ok)
# ... and either it did work without `-lm`, or ...
set(LIBM_NEEDED FALSE CACHE BOOL ${_lmn_desc})
- message(STATUS "CheckLibM: math works without -lm")
+ message(STATUS "CheckLibM: don't need -lm when linking with math-using ${_lib_type} lib")
else()
# ... it did not work without -lm.
# Does it does work *with* -lm?
@@ -133,7 +141,7 @@
if(_checklibm_with_libm_ok)
# Yes, it does work with -lm.
set(LIBM_NEEDED TRUE CACHE BOOL "${_lmn_desc}")
- message(STATUS "CheckLibM: yes, math requires explicit -lm")
+ message(STATUS "CheckLibM: yes, do need -lm when linking with math-using ${_lib_type} lib")
else()
# Yikes, it failed both without and with -lm. Bye.
message(FATAL_ERROR
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|