-
Notifications
You must be signed in to change notification settings - Fork 3
Several CMake modernization and MSVC compile fix #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,7 +37,7 @@ | |
| # patches are most welcome! Please send them to the development mailing list. | ||
|
|
||
|
|
||
| cmake_minimum_required(VERSION 3.6 FATAL_ERROR) | ||
| cmake_minimum_required(VERSION 3.6...4.2 FATAL_ERROR) | ||
|
|
||
| set (CMAKE_CXX_STANDARD 14) | ||
| set (CMAKE_CXX_STANDARD_REQUIRED 11) | ||
|
|
@@ -82,46 +82,30 @@ find_package(Threads REQUIRED) | |
|
|
||
| # Find the Boost and Xerces libraries | ||
|
|
||
| set(Boost_USE_MULTITHREADED ON) | ||
| find_package(Boost | ||
| find_package(Boost CONFIG REQUIRED | ||
| COMPONENTS | ||
| smart_ptr | ||
| crc | ||
| math | ||
| program_options | ||
| thread | ||
| filesystem | ||
| variant | ||
| format | ||
| lexical_cast | ||
| uuid | ||
| OPTIONAL_COMPONENTS | ||
| system | ||
| ) | ||
| if (NOT Boost_FOUND) | ||
| set(BOOST_ROOT CACHE PATH "Location of the boost root directory" ) | ||
| message(FATAL_ERROR | ||
| "Unable to find boost library. | ||
| Please set the BOOST_ROOT to point to the boost distribution files." | ||
| ) | ||
| endif(NOT Boost_FOUND) | ||
|
|
||
| find_package(Xerces) | ||
| if (NOT Xerces_FOUND) | ||
| set(XERCES_ROOT CACHE PATH "Location of the xerces library") | ||
| message(FATAL_ERROR | ||
| "Unable to find xerces library. | ||
| Please set the the XERCES_ROOT to point to the root of the xerces directory." | ||
| ) | ||
| endif (NOT Xerces_FOUND) | ||
|
|
||
| set(XML_LIBRARIES ${Xerces_LIBRARY}) | ||
| set(XML_INCLUDE_DIRS ${Xerces_INCLUDE_DIR}) | ||
|
|
||
| find_package(XercesC REQUIRED) | ||
|
|
||
| if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") | ||
| add_definitions(-DLINUX) | ||
| find_package(ICU REQUIRED) | ||
| set(XML_LIBRARIES ${XML_LIBRARIES} ${ICU_LIBRARIES}) | ||
| set(XML_INCLUDE_DIRS ${XML_INCLUDE_DIRS} ${ICU_INCLUDE_DIRS}) | ||
| elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | ||
| add_definitions(-DWINDOWS) | ||
| endif() | ||
|
|
||
| add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) | ||
| add_definitions(-DBOOST_ALL_NO_LIB -DXERCES_STATIC_LIBRARY) | ||
| add_definitions(-DE57_REFIMPL_REVISION_ID=${PROJECT_NAME}-${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_BUILD_VERSION}-${${PROJECT_NAME}_BUILD_TAG}) | ||
|
|
||
| configure_file ( | ||
|
|
@@ -134,12 +118,6 @@ include_directories( | |
| include | ||
| include/time_conversion | ||
| src/refimpl | ||
| ${XML_INCLUDE_DIRS} | ||
| ${Boost_INCLUDE_DIR} | ||
| ) | ||
|
|
||
| link_directories( | ||
| ${Boost_LIBRARY_DIRS} | ||
| ) | ||
|
|
||
|
|
||
|
|
@@ -161,6 +139,15 @@ set_target_properties( E57RefImpl | |
| PROPERTIES DEBUG_POSTFIX "-d" | ||
| ) | ||
|
|
||
| target_link_libraries( E57RefImpl | ||
| PUBLIC | ||
| Boost::crc | ||
| Boost::smart_ptr | ||
| Boost::uuid | ||
| Threads::Threads | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See notes above:
|
||
| XercesC::XercesC | ||
| ) | ||
|
|
||
| # | ||
| # Files for LAS format support | ||
| # | ||
|
|
@@ -170,6 +157,11 @@ add_library( LASReader STATIC | |
| include/LASReader.h | ||
| ) | ||
|
|
||
| target_link_libraries( LASReader | ||
| PUBLIC | ||
| E57RefImpl | ||
| ) | ||
|
|
||
| # | ||
| # Time conversion utilities | ||
| # | ||
|
|
@@ -191,16 +183,12 @@ add_executable( DemoWrite01 | |
| ) | ||
| target_link_libraries( DemoWrite01 | ||
| E57RefImpl | ||
| ${XML_LIBRARIES} | ||
| ${CMAKE_THREAD_LIBS_INIT} | ||
| ) | ||
| add_executable( DemoRead01 | ||
| src/examples/DemoRead01.cpp | ||
| ) | ||
| target_link_libraries( DemoRead01 | ||
| E57RefImpl | ||
| ${XML_LIBRARIES} | ||
| ${CMAKE_THREAD_LIBS_INIT} | ||
| ) | ||
|
|
||
| # | ||
|
|
@@ -214,41 +202,36 @@ target_link_libraries( las2e57 | |
| E57RefImpl | ||
| LASReader | ||
| time_conversion | ||
| ${XML_LIBRARIES} | ||
| ${CMAKE_THREAD_LIBS_INIT} | ||
| ) | ||
| add_executable( e57fields | ||
| src/tools/e57fields.cpp | ||
| ) | ||
| target_link_libraries( e57fields | ||
| E57RefImpl | ||
| ${XML_LIBRARIES} | ||
| ${CMAKE_THREAD_LIBS_INIT} | ||
| Boost::smart_ptr | ||
| ) | ||
| add_executable( e57xmldump | ||
| src/tools/e57xmldump.cpp | ||
| ) | ||
| target_link_libraries( e57xmldump | ||
| E57RefImpl | ||
| ${XML_LIBRARIES} | ||
| ${CMAKE_THREAD_LIBS_INIT} | ||
| ) | ||
| add_executable( e57validate | ||
| src/tools/e57validate.cpp | ||
| ) | ||
| target_link_libraries( e57validate | ||
| E57RefImpl | ||
| ${XML_LIBRARIES} | ||
| ${CMAKE_THREAD_LIBS_INIT} | ||
| ) | ||
| add_executable( e57unpack | ||
| src/tools/e57unpack.cpp | ||
| ) | ||
| target_link_libraries( e57unpack | ||
| E57RefImpl | ||
| ${XML_LIBRARIES} | ||
| ${Boost_LIBRARIES} | ||
| ${CMAKE_THREAD_LIBS_INIT} | ||
| Boost::filesystem | ||
| Boost::format | ||
| Boost::lexical_cast | ||
| Boost::program_options | ||
| Boost::variant | ||
| ) | ||
|
|
||
| # | ||
|
|
||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -57,6 +57,10 @@ | |||||
| #include "E57Foundation.h" | ||||||
| #endif | ||||||
|
|
||||||
| #ifdef WIN32 | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not in this case, as this definition only corresponds to the one below and is therefore consistent in this way. This library requires a major modernization and a of it would be to refactor the usage of macros, but that would have only inflated the PR further and therefore I adjusted it to the current style. |
||||||
| #include <windows.h> | ||||||
| #endif | ||||||
|
|
||||||
| using namespace std; | ||||||
| using namespace boost; | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only choose 4.2 if you actually verified that it does the right thing with CMake policies for 4.2 across all platforms and configurations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested it with 4.2 locally and as this port didn't required any adjustment in the CMake 4.2-PR-Drafts in vcpkg I don't assume there is any breakage in other platforms.