3737# patches are most welcome! Please send them to the development mailing list.
3838
3939
40- cmake_minimum_required (VERSION 3.6 FATAL_ERROR )
40+ cmake_minimum_required (VERSION 3.6...4.2 FATAL_ERROR )
4141
4242set (CMAKE_CXX_STANDARD 14)
4343set (CMAKE_CXX_STANDARD_REQUIRED 11)
@@ -82,46 +82,30 @@ find_package(Threads REQUIRED)
8282
8383# Find the Boost and Xerces libraries
8484
85- set (Boost_USE_MULTITHREADED ON )
86- find_package (Boost
85+ find_package (Boost CONFIG REQUIRED
8786 COMPONENTS
87+ smart_ptr
88+ crc
89+ math
8890 program_options
89- thread
9091 filesystem
92+ variant
93+ format
94+ lexical_cast
95+ uuid
9196 OPTIONAL_COMPONENTS
9297 system
9398)
94- if (NOT Boost_FOUND)
95- set (BOOST_ROOT CACHE PATH "Location of the boost root directory" )
96- message (FATAL_ERROR
97- "Unable to find boost library.
98- Please set the BOOST_ROOT to point to the boost distribution files."
99- )
100- endif (NOT Boost_FOUND )
101-
102- find_package (Xerces )
103- if (NOT Xerces_FOUND)
104- set (XERCES_ROOT CACHE PATH "Location of the xerces library" )
105- message (FATAL_ERROR
106- "Unable to find xerces library.
107- Please set the the XERCES_ROOT to point to the root of the xerces directory."
108- )
109- endif (NOT Xerces_FOUND )
11099
111- set (XML_LIBRARIES ${Xerces_LIBRARY} )
112- set (XML_INCLUDE_DIRS ${Xerces_INCLUDE_DIR} )
100+
101+ find_package ( XercesC REQUIRED )
113102
114103if (${CMAKE_SYSTEM_NAME } STREQUAL "Linux" )
115104 add_definitions (-DLINUX )
116- find_package (ICU REQUIRED )
117- set (XML_LIBRARIES ${XML_LIBRARIES} ${ICU_LIBRARIES} )
118- set (XML_INCLUDE_DIRS ${XML_INCLUDE_DIRS} ${ICU_INCLUDE_DIRS} )
119105elseif (${CMAKE_SYSTEM_NAME } STREQUAL "Windows" )
120106 add_definitions (-DWINDOWS )
121107endif ()
122108
123- add_definitions (${Boost_LIB_DIAGNOSTIC_DEFINITIONS} )
124- add_definitions (-DBOOST_ALL_NO_LIB -DXERCES_STATIC_LIBRARY )
125109add_definitions (-DE57_REFIMPL_REVISION_ID=${PROJECT_NAME}-${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_BUILD_VERSION}-${${PROJECT_NAME}_BUILD_TAG} )
126110
127111configure_file (
@@ -134,12 +118,6 @@ include_directories(
134118 include
135119 include /time_conversion
136120 src/refimpl
137- ${XML_INCLUDE_DIRS}
138- ${Boost_INCLUDE_DIR}
139- )
140-
141- link_directories (
142- ${Boost_LIBRARY_DIRS}
143121)
144122
145123
@@ -161,6 +139,15 @@ set_target_properties( E57RefImpl
161139 PROPERTIES DEBUG_POSTFIX "-d"
162140)
163141
142+ target_link_libraries ( E57RefImpl
143+ PUBLIC
144+ Boost::crc
145+ Boost::smart_ptr
146+ Boost::uuid
147+ Threads::Threads
148+ XercesC::XercesC
149+ )
150+
164151#
165152# Files for LAS format support
166153#
@@ -170,6 +157,11 @@ add_library( LASReader STATIC
170157 include /LASReader.h
171158)
172159
160+ target_link_libraries ( LASReader
161+ PUBLIC
162+ E57RefImpl
163+ )
164+
173165#
174166# Time conversion utilities
175167#
@@ -191,16 +183,12 @@ add_executable( DemoWrite01
191183)
192184target_link_libraries ( DemoWrite01
193185 E57RefImpl
194- ${XML_LIBRARIES}
195- ${CMAKE_THREAD_LIBS_INIT}
196186)
197187add_executable ( DemoRead01
198188 src/examples/DemoRead01.cpp
199189)
200190target_link_libraries ( DemoRead01
201191 E57RefImpl
202- ${XML_LIBRARIES}
203- ${CMAKE_THREAD_LIBS_INIT}
204192)
205193
206194#
@@ -214,41 +202,36 @@ target_link_libraries( las2e57
214202 E57RefImpl
215203 LASReader
216204 time_conversion
217- ${XML_LIBRARIES}
218- ${CMAKE_THREAD_LIBS_INIT}
219205)
220206add_executable ( e57fields
221207 src/tools/e57fields.cpp
222208)
223209target_link_libraries ( e57fields
224210 E57RefImpl
225- ${XML_LIBRARIES}
226- ${CMAKE_THREAD_LIBS_INIT}
211+ Boost::smart_ptr
227212)
228213add_executable ( e57xmldump
229214 src/tools/e57xmldump.cpp
230215)
231216target_link_libraries ( e57xmldump
232217 E57RefImpl
233- ${XML_LIBRARIES}
234- ${CMAKE_THREAD_LIBS_INIT}
235218)
236219add_executable ( e57validate
237220 src/tools/e57validate.cpp
238221)
239222target_link_libraries ( e57validate
240223 E57RefImpl
241- ${XML_LIBRARIES}
242- ${CMAKE_THREAD_LIBS_INIT}
243224)
244225add_executable ( e57unpack
245226 src/tools/e57unpack.cpp
246227)
247228target_link_libraries ( e57unpack
248229 E57RefImpl
249- ${XML_LIBRARIES}
250- ${Boost_LIBRARIES}
251- ${CMAKE_THREAD_LIBS_INIT}
230+ Boost::filesystem
231+ Boost::format
232+ Boost::lexical_cast
233+ Boost::program_options
234+ Boost::variant
252235)
253236
254237#
0 commit comments