summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Mrázek2012-03-13 16:10:07 (GMT)
committerPetr Mrázek2012-03-13 16:10:07 (GMT)
commit49fa800615a4e5c872164bcb4122030d2ebda9cf (patch)
treede3e1a742b298a8533276d69e2a282b31b3ae040
parent9f3026df545efeccb9bf33fe56f47bdee4c06e4a (diff)
downloadclsocket-49fa800615a4e5c872164bcb4122030d2ebda9cf.tar.gz
clsocket-49fa800615a4e5c872164bcb4122030d2ebda9cf.tar.bz2
clsocket-49fa800615a4e5c872164bcb4122030d2ebda9cf.tar.xz
Make clsocket subproject-friendly by adding more build options.
-rw-r--r--CMakeLists.txt26
1 files changed, 20 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a737ba0..dc30415 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,19 +50,31 @@ elseif(WIN32)
endif()
OPTION(CLSOCKET_SHARED "Build clsocket lib as shared." ON)
+OPTION(CLSOCKET_DEP_ONLY "Build for use inside other CMake projects as dependency." OFF)
# make the lib
if(CLSOCKET_SHARED)
- ADD_LIBRARY(clsocket SHARED ${CLSOCKET_SOURCES})
+ if(CLSOCKET_DEP_ONLY)
+ ADD_LIBRARY(clsocket SHARED EXCLUDE_FROM_ALL ${CLSOCKET_SOURCES})
+ else()
+ ADD_LIBRARY(clsocket SHARED ${CLSOCKET_SOURCES})
+ endif()
else()
- ADD_LIBRARY(clsocket STATIC ${CLSOCKET_SOURCES})
+ if(CLSOCKET_DEP_ONLY)
+ ADD_LIBRARY(clsocket STATIC EXCLUDE_FROM_ALL ${CLSOCKET_SOURCES})
+ else()
+ ADD_LIBRARY(clsocket STATIC ${CLSOCKET_SOURCES})
+ endif()
endif()
-
TARGET_LINK_LIBRARIES(clsocket ${PROJECT_LIBS})
# install into configured prefix
-install(TARGETS clsocket ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
-install(FILES ${CLSOCKET_HEADERS} DESTINATION include)
+if(NOT CLSOCKET_DEP_ONLY)
+ install(TARGETS clsocket ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
+ install(FILES ${CLSOCKET_HEADERS} DESTINATION include)
+else()
+
+endif()
if(UNIX)
OPTION(CLSOCKET_EXAMPLES "Build the examples" OFF)
@@ -70,7 +82,9 @@ if(UNIX)
if(CLSOCKET_EXAMPLES)
ADD_EXECUTABLE(clsocket-example examples/RecvAsync.cpp)
TARGET_LINK_LIBRARIES(clsocket-example clsocket pthread)
- install(TARGETS clsocket-example DESTINATION bin)
+ if(NOT CLSOCKET_DEP_ONLY)
+ install(TARGETS clsocket-example DESTINATION bin)
+ endif()
endif()
endif()