summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Hector Martin2010-02-07 01:59:03 +0100
committerGravatar Hector Martin2010-02-07 02:00:31 +0100
commitc9db7c05573bee6e819ae76095e0d80f5fe02dd4 (patch)
tree2ee4c78140ca4ac53e7aaf1fd760979338c79df9
parent003e72659b579e4376d099767f2e757e80d8f2a4 (diff)
downloadusbmuxd-c9db7c05573bee6e819ae76095e0d80f5fe02dd4.tar.gz
usbmuxd-c9db7c05573bee6e819ae76095e0d80f5fe02dd4.tar.bz2
Clean up CMakeLists (inspired by Gentoo patch)
-rw-r--r--CMakeLists.txt33
-rw-r--r--daemon/CMakeLists.txt3
-rw-r--r--libusbmuxd/CMakeLists.txt6
-rw-r--r--tools/CMakeLists.txt1
4 files changed, 24 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 01dda18..64ef37f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,21 +1,26 @@
PROJECT(usbmuxd)
-SET ( USBMUXD_VERSION "1.0.0" )
-SET ( LIBUSBMUXD_VERSION "${USBMUXD_VERSION}" )
-SET ( LIBUSBMUXD_SOVERSION "1" )
+set(USBMUXD_VERSION "1.0.0")
+set(LIBUSBMUXD_VERSION "${USBMUXD_VERSION}")
+set(LIBUSBMUXD_SOVERSION "1")
cmake_minimum_required(VERSION 2.6)
-IF(NOT DEFINED LIB_SUFFIX)
- IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
- SET(LIB_SUFFIX "64" CACHE STRING "Define suffix of library directory name (32/64)" )
- ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
- SET(LIB_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
- ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
-ENDIF(NOT DEFINED LIB_SUFFIX)
+if(NOT DEFINED LIB_SUFFIX)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(LIB_SUFFIX "64" CACHE STRING "Define suffix of library directory name (32/64)" )
+ else(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(LIB_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
+ endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+endif(NOT DEFINED LIB_SUFFIX)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/Modules/")
+# let CFLAGS env override this
+if(CMAKE_C_FLAGS STREQUAL "")
+ set(CMAKE_C_FLAGS "-O2")
+endif(CMAKE_C_FLAGS STREQUAL "")
+
add_definitions(-Wall)
add_subdirectory (libusbmuxd)
@@ -24,10 +29,10 @@ add_subdirectory (tools)
add_subdirectory (udev)
# pkg-config
-CONFIGURE_FILE ("${CMAKE_SOURCE_DIR}/libusbmuxd.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libusbmuxd.pc")
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libusbmuxd.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libusbmuxd.pc")
# install pkg-config file
-INSTALL (FILES "${CMAKE_CURRENT_BINARY_DIR}/libusbmuxd.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig/)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libusbmuxd.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig/)
# add uninstall target
-CONFIGURE_FILE( "${CMAKE_SOURCE_DIR}/Modules/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
-ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
+configure_file("${CMAKE_SOURCE_DIR}/Modules/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
+add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt
index 1ba052c..6593deb 100644
--- a/daemon/CMakeLists.txt
+++ b/daemon/CMakeLists.txt
@@ -6,9 +6,8 @@ include_directories (${CMAKE_SOURCE_DIR}/common)
include_directories (${CMAKE_SOURCE_DIR}/daemon)
include_directories (${CMAKE_SOURCE_DIR}/libusbmuxd)
-add_definitions(-O2 -g)
add_definitions(-DUSBMUXD_DAEMON -DUSBMUXD_VERSION="${USBMUXD_VERSION}")
-add_executable(usbmuxd main.c usb-linux.c log.c ../common/utils.c device.c client.c)
+add_executable(usbmuxd main.c usb-linux.c log.c ${CMAKE_SOURCE_DIR}/common/utils.c device.c client.c)
target_link_libraries(usbmuxd ${LIBS})
install(TARGETS usbmuxd RUNTIME DESTINATION sbin)
diff --git a/libusbmuxd/CMakeLists.txt b/libusbmuxd/CMakeLists.txt
index d062f23..d275169 100644
--- a/libusbmuxd/CMakeLists.txt
+++ b/libusbmuxd/CMakeLists.txt
@@ -1,8 +1,10 @@
include_directories (${CMAKE_SOURCE_DIR}/common)
+find_package(Threads)
-add_library (libusbmuxd SHARED libusbmuxd.c sock_stuff.c ../common/utils.c)
+add_library (libusbmuxd SHARED libusbmuxd.c sock_stuff.c ${CMAKE_SOURCE_DIR}/common/utils.c)
find_library (PTHREAD pthread)
-target_link_libraries (libusbmuxd ${PTHREAD})
+target_link_libraries (libusbmuxd ${CMAKE_THREAD_LIBS_INIT})
+
# 'lib' is a UNIXism, the proper CMake target is usbmuxd
# But we can't use that due to the conflict with the usbmuxd daemon,
# so instead change the library output base name to usbmuxd here
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 47ffa90..08ea714 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -1,7 +1,6 @@
include_directories (${CMAKE_SOURCE_DIR}/libusbmuxd)
link_directories (${CMAKE_BINARY_DIR}/libusbmuxd)
-add_definitions(-O2 -g)
add_executable(iproxy iproxy.c)
target_link_libraries(iproxy libusbmuxd pthread)