null+****@clear*****
null+****@clear*****
2012年 4月 13日 (金) 17:04:22 JST
Kouhei Sutou 2012-04-13 17:04:22 +0900 (Fri, 13 Apr 2012)
New Revision: 2510235836180f18887a1fd4b506f99dd91e1d62
Log:
cmake: set _LIBS automatically
Modified files:
CMakeLists.txt
lib/CMakeLists.txt
Modified: CMakeLists.txt (+7 -8)
===================================================================
--- CMakeLists.txt 2012-04-13 15:14:19 +0900 (035f59c)
+++ CMakeLists.txt 2012-04-13 17:04:22 +0900 (a248af1)
@@ -54,10 +54,13 @@ macro(ac_check_headers header)
endmacro()
macro(ac_check_lib library function)
- string(REGEX REPLACE "[/.]" "_" output_variable_name ${library})
- string(TOUPPER "${output_variable_name}" output_variable_name)
- set(output_variable_name "HAVE_${output_variable_name}")
+ string(REGEX REPLACE "[/.]" "_" output_variable_base_name ${library})
+ string(TOUPPER "${output_variable_base_name}" output_variable_base_name)
+ set(output_variable_name "HAVE_${output_variable_base_name}")
check_library_exists(${library} ${function} "" ${output_variable_name})
+ if(${output_variable_name})
+ set(${output_variable_base_name}_LIBS "${library}")
+ endif()
endmacro()
include(build/ac_macros/check_headers.m4)
@@ -65,9 +68,7 @@ include(build/ac_macros/check_headers.m4)
if(UNIX)
ac_check_headers(pthread.h)
ac_check_lib(pthread pthread_mutex_init "" "")
- if(${HAVE_PTHREAD} EQUAL 1)
- set(PTHREAD_LIBS "pthread")
- else()
+ if(NOT ${HAVE_PTHREAD} EQUAL 1)
message(FATAL_ERROR "No libpthread found")
endif()
endif()
@@ -78,7 +79,6 @@ if(WITH_ZLIB)
if (NOT HAVE_Z)
message(FATAL_ERROR "No libz found")
endif()
- set(ZLIB_LIBS "z")
endif()
option(WITH_LZO "use LZO for data compression." OFF)
@@ -87,7 +87,6 @@ if(WITH_LZO)
if (NOT HAVE_LZO2)
message(FATAL_ERROR "No liblzo2 found")
endif()
- set(LZO_LIBS "lzo2")
endif()
add_subdirectory(lib)
Modified: lib/CMakeLists.txt (+1 -1)
===================================================================
--- lib/CMakeLists.txt 2012-04-13 15:14:19 +0900 (2173113)
+++ lib/CMakeLists.txt 2012-04-13 17:04:22 +0900 (bc13ba8)
@@ -26,4 +26,4 @@ string(REGEX REPLACE "([^;]+)" "dat/\\1"
add_library(libgroonga SHARED ${LIBGROONGA_SOURCES} ${LIBGRNDAT_SOURCES})
set_target_properties(libgroonga PROPERTIES OUTPUT_NAME "groonga")
-target_link_libraries(libgroonga ${PTHREAD_LIBS} ${ZLIB_LIBS} ${LZO_LIBS})
+target_link_libraries(libgroonga ${PTHREAD_LIBS} ${Z_LIBS} ${LZO_LIBS})