@@ -28,12 +28,23 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/thrift/include)
2828# Add cpp-client include directory
2929INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR} /client/include )
3030
31- FIND_PACKAGE (OpenSSL REQUIRED)
32- IF (OpenSSL_FOUND)
33- MESSAGE (STATUS "OpenSSL found: ${OPENSSL_VERSION} " )
34- INCLUDE_DIRECTORIES (${OPENSSL_INCLUDE_DIR} )
31+ # =========================
32+ # SSL option (default OFF)
33+ # =========================
34+ option (WITH_SSL "Build with SSL support" OFF )
35+
36+ IF (WITH_SSL)
37+ FIND_PACKAGE (OpenSSL REQUIRED)
38+ IF (OpenSSL_FOUND)
39+ MESSAGE (STATUS "OpenSSL found: ${OPENSSL_VERSION} " )
40+ INCLUDE_DIRECTORIES (${OPENSSL_INCLUDE_DIR} )
41+ ADD_DEFINITIONS (-DWITH_SSL=1)
42+ ELSE ()
43+ MESSAGE (FATAL_ERROR "OpenSSL not found, but WITH_SSL is enabled" )
44+ ENDIF ()
3545ELSE ()
36- MESSAGE (FATAL_ERROR "OpenSSL not found" )
46+ MESSAGE (STATUS "Building without SSL support" )
47+ ADD_DEFINITIONS (-DWITH_SSL=0)
3748ENDIF ()
3849
3950FIND_PACKAGE (Boost REQUIRED)
@@ -50,53 +61,91 @@ ADD_EXECUTABLE(TableModelSessionExample TableModelSessionExample.cpp)
5061ADD_EXECUTABLE (MultiSvrNodeClient MultiSvrNodeClient.cpp)
5162
5263IF (MSVC )
53- TARGET_LINK_LIBRARIES (SessionExample
54- iotdb_session
55- "${CMAKE_SOURCE_DIR} /thrift/lib/Release/thriftmd.lib"
56- OpenSSL::SSL
57- OpenSSL::Crypto
58- )
59- TARGET_LINK_LIBRARIES (AlignedTimeseriesSessionExample
60- iotdb_session
61- "${CMAKE_SOURCE_DIR} /thrift/lib/Release/thriftmd.lib"
62- OpenSSL::SSL
63- OpenSSL::Crypto
64- )
65- TARGET_LINK_LIBRARIES (TableModelSessionExample
66- iotdb_session
67- "${CMAKE_SOURCE_DIR} /thrift/lib/Release/thriftmd.lib"
68- OpenSSL::SSL
69- OpenSSL::Crypto
70- )
71- TARGET_LINK_LIBRARIES (MultiSvrNodeClient
72- iotdb_session
73- "${CMAKE_SOURCE_DIR} /thrift/lib/Release/thriftmd.lib"
74- OpenSSL::SSL
75- OpenSSL::Crypto
76- )
64+ IF (WITH_SSL)
65+ TARGET_LINK_LIBRARIES (SessionExample
66+ iotdb_session
67+ "${CMAKE_SOURCE_DIR} /thrift/lib/Release/thriftmd.lib"
68+ OpenSSL::SSL
69+ OpenSSL::Crypto
70+ )
71+ TARGET_LINK_LIBRARIES (AlignedTimeseriesSessionExample
72+ iotdb_session
73+ "${CMAKE_SOURCE_DIR} /thrift/lib/Release/thriftmd.lib"
74+ OpenSSL::SSL
75+ OpenSSL::Crypto
76+ )
77+ TARGET_LINK_LIBRARIES (TableModelSessionExample
78+ iotdb_session
79+ "${CMAKE_SOURCE_DIR} /thrift/lib/Release/thriftmd.lib"
80+ OpenSSL::SSL
81+ OpenSSL::Crypto
82+ )
83+ TARGET_LINK_LIBRARIES (MultiSvrNodeClient
84+ iotdb_session
85+ "${CMAKE_SOURCE_DIR} /thrift/lib/Release/thriftmd.lib"
86+ OpenSSL::SSL
87+ OpenSSL::Crypto
88+ )
89+ ELSE ()
90+ TARGET_LINK_LIBRARIES (SessionExample
91+ iotdb_session
92+ "${CMAKE_SOURCE_DIR} /thrift/lib/Release/thriftmd.lib"
93+ )
94+ TARGET_LINK_LIBRARIES (AlignedTimeseriesSessionExample
95+ iotdb_session
96+ "${CMAKE_SOURCE_DIR} /thrift/lib/Release/thriftmd.lib"
97+ )
98+ TARGET_LINK_LIBRARIES (TableModelSessionExample
99+ iotdb_session
100+ "${CMAKE_SOURCE_DIR} /thrift/lib/Release/thriftmd.lib"
101+ )
102+ TARGET_LINK_LIBRARIES (MultiSvrNodeClient
103+ iotdb_session
104+ "${CMAKE_SOURCE_DIR} /thrift/lib/Release/thriftmd.lib"
105+ )
106+ ENDIF ()
77107ELSE ()
78- TARGET_LINK_LIBRARIES (SessionExample
79- iotdb_session
80- pthread
81- OpenSSL::SSL
82- OpenSSL::Crypto
83- )
84- TARGET_LINK_LIBRARIES (AlignedTimeseriesSessionExample
85- iotdb_session
86- pthread
87- OpenSSL::SSL
88- OpenSSL::Crypto
89- )
90- TARGET_LINK_LIBRARIES (TableModelSessionExample
91- iotdb_session
92- pthread
93- OpenSSL::SSL
94- OpenSSL::Crypto
95- )
96- TARGET_LINK_LIBRARIES (MultiSvrNodeClient
97- iotdb_session
98- pthread
99- OpenSSL::SSL
100- OpenSSL::Crypto
101- )
102- ENDIF ()
108+ IF (WITH_SSL)
109+ TARGET_LINK_LIBRARIES (SessionExample
110+ iotdb_session
111+ pthread
112+ OpenSSL::SSL
113+ OpenSSL::Crypto
114+ )
115+ TARGET_LINK_LIBRARIES (AlignedTimeseriesSessionExample
116+ iotdb_session
117+ pthread
118+ OpenSSL::SSL
119+ OpenSSL::Crypto
120+ )
121+ TARGET_LINK_LIBRARIES (TableModelSessionExample
122+ iotdb_session
123+ pthread
124+ OpenSSL::SSL
125+ OpenSSL::Crypto
126+ )
127+ TARGET_LINK_LIBRARIES (MultiSvrNodeClient
128+ iotdb_session
129+ pthread
130+ OpenSSL::SSL
131+ OpenSSL::Crypto
132+ )
133+ ELSE ()
134+ TARGET_LINK_LIBRARIES (SessionExample
135+ iotdb_session
136+ pthread
137+ )
138+ TARGET_LINK_LIBRARIES (AlignedTimeseriesSessionExample
139+ iotdb_session
140+ pthread
141+ )
142+ TARGET_LINK_LIBRARIES (TableModelSessionExample
143+ iotdb_session
144+ pthread
145+ )
146+ TARGET_LINK_LIBRARIES (MultiSvrNodeClient
147+ iotdb_session
148+ pthread
149+ )
150+ ENDIF ()
151+ ENDIF ()
0 commit comments