1 diff --git a/CMakeLists.txt b/CMakeLists.txt
2 index 55653f12..d35b499d 100644
5 @@ -95,6 +95,8 @@ if (WIN32)
9 +option (UPNP_BUILD_SHARED "Build shared libraries" ON)
10 +option (UPNP_BUILD_STATIC "Build static libraries" ON)
11 option (BUILD_TESTING "Run Tests after compile" ON)
14 diff --git a/ixml/CMakeLists.txt b/ixml/CMakeLists.txt
15 index e33a561e..184f65d0 100644
16 --- a/ixml/CMakeLists.txt
17 +++ b/ixml/CMakeLists.txt
18 @@ -15,6 +15,7 @@ set (IXML_SOURCES
22 +if (UPNP_BUILD_SHARED)
23 add_library (ixml_shared SHARED
26 @@ -54,7 +55,9 @@ install (TARGETS ixml_shared
27 INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/upnp
28 PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/upnp
32 +if (UPNP_BUILD_STATIC)
33 add_library (ixml_static STATIC
36 @@ -93,6 +96,7 @@ install (TARGETS ixml_static
37 DESTINATION ${CMAKE_INSTALL_LIBDIR}
38 INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/upnp
43 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/IXML
44 diff --git a/ixml/test/CMakeLists.txt b/ixml/test/CMakeLists.txt
45 index 7dea06eb..1241e856 100644
46 --- a/ixml/test/CMakeLists.txt
47 +++ b/ixml/test/CMakeLists.txt
48 @@ -2,6 +2,7 @@ FILE (GLOB XML_FILES
49 ${CMAKE_CURRENT_SOURCE_DIR}/testdata/*.xml
52 +if (UPNP_BUILD_SHARED)
53 ADD_EXECUTABLE (test-ixml-shared
56 @@ -17,7 +18,9 @@ ADD_TEST (NAME test-ixml
57 SET_TESTS_PROPERTIES (test-ixml PROPERTIES
58 ENVIRONMENT "PATH=$<TARGET_FILE_DIR:ixml_shared>\;%PATH%"
62 +if (UPNP_BUILD_STATIC)
63 ADD_EXECUTABLE (test-ixml-static
66 @@ -29,3 +32,4 @@ TARGET_LINK_LIBRARIES (test-ixml-static
67 ADD_TEST (NAME test-ixml-static
68 COMMAND test-ixml-static ${XML_FILES}
71 diff --git a/upnp/CMakeLists.txt b/upnp/CMakeLists.txt
72 index d10336f9..c9d19f8d 100644
73 --- a/upnp/CMakeLists.txt
74 +++ b/upnp/CMakeLists.txt
75 @@ -83,6 +83,7 @@ if (uuid)
79 +if (UPNP_BUILD_SHARED)
80 add_library (upnp_shared SHARED
83 @@ -182,7 +183,9 @@ install (TARGETS upnp_shared
84 INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/upnp
85 PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/upnp
89 +if (UPNP_BUILD_STATIC)
90 add_library (upnp_static STATIC
93 @@ -233,6 +236,7 @@ install (TARGETS upnp_static
94 DESTINATION ${CMAKE_INSTALL_LIBDIR}
95 INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/upnp
100 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/UPNP
101 diff --git a/upnp/test/CMakeLists.txt b/upnp/test/CMakeLists.txt
102 index 741f9a57..745f2148 100644
103 --- a/upnp/test/CMakeLists.txt
104 +++ b/upnp/test/CMakeLists.txt
105 @@ -4,6 +4,7 @@ if (WIN32)
106 string (APPEND TEST_ENV "%PATH%")
109 +if (UPNP_BUILD_SHARED)
110 add_executable (test-upnp-init ${WIN_EXE}
113 @@ -23,7 +24,9 @@ add_test (NAME test-upnp-init
114 set_tests_properties (test-upnp-init PROPERTIES
115 ENVIRONMENT "${TEST_ENV}"
119 +if (UPNP_BUILD_STATIC)
120 add_executable (test-upnp-init-static
123 @@ -39,7 +42,9 @@ target_compile_definitions (test-upnp-init-static
124 add_test (NAME test-upnp-init-static
125 COMMAND test-upnp-init-static
129 +if (UPNP_BUILD_SHARED)
130 add_executable (test-upnp-list
133 @@ -55,7 +60,9 @@ set_tests_properties (test-upnp-list PROPERTIES
134 target_link_libraries (test-upnp-list
139 +if (UPNP_BUILD_STATIC)
140 add_executable (test-upnp-list-static
143 @@ -67,7 +74,9 @@ target_link_libraries (test-upnp-list-static
144 add_test (NAME test-upnp-list-static
145 COMMAND test-upnp-list-static
149 +if (UPNP_BUILD_SHARED)
150 add_executable (test-upnp-log
153 @@ -87,7 +96,9 @@ add_test (NAME test-upnp-log
154 set_tests_properties (test-upnp-log PROPERTIES
155 ENVIRONMENT "${TEST_ENV}"
159 +if (UPNP_BUILD_STATIC)
160 add_executable (test-upnp-log-static
163 @@ -103,7 +114,9 @@ target_link_libraries (test-upnp-log-static
164 add_test (NAME test-upnp-log-static
165 COMMAND test-upnp-log-static
169 +if (UPNP_BUILD_SHARED)
170 add_executable (test-upnp-url
173 @@ -119,7 +132,9 @@ add_test (NAME test-upnp-url
174 set_tests_properties (test-upnp-url PROPERTIES
175 ENVIRONMENT "${TEST_ENV}"
179 +if (UPNP_BUILD_STATIC)
180 add_executable (test-upnp-url-static
183 @@ -131,3 +146,4 @@ target_link_libraries (test-upnp-url-static
184 add_test (NAME test-upnp-url-static
185 COMMAND test-upnp-url-static