vcpkg/ports/freeopcua/cmakelists_fixes.patch

205 lines
7.3 KiB
Diff
Raw Normal View History

diff --git a/CMakeLists.txt b/CMakeLists.txt
index de03564..2637355 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,8 @@ if( NOT CMAKE_BUILD_TYPE )
endif()
project(freeopcua)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
option(BUILD_CLIENT "Build Client" ON)
option(BUILD_SERVER "Build Server" ON)
@@ -16,28 +18,6 @@ option(BUILD_PYTHON "Build Python bindings" ON)
option(BUILD_TESTING "Build and run tests" OFF)
OPTION(BUILD_SHARED_LIBS "Build shared libraries." ON)
-IF (NOT DEFINED CMAKE_INSTALL_LIBDIR)
- SET(CMAKE_INSTALL_LIBDIR lib)
-ENDIF ()
-
-SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY
- ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
- CACHE PATH
- ""
- )
-
-SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY
- ${PROJECT_BINARY_DIR}/bin
- CACHE PATH
- ""
- )
-
-SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY
- ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
- CACHE PATH
- ""
- )
-
# Helper function to generate a pkg-config file for a single library
# Takes the filename of the .pc file as a parameter and replaces all
# placeholders in the .pc.in file with the actual values
@@ -60,23 +40,12 @@ function(generate_pkgconfig BASENAME)
endif()
endfunction(generate_pkgconfig)
if(MSVC)
- SET(STATIC_LIBRARY_CXX_FLAGS /MDd CACHE STRING "")
- SET(EXECUTABLE_CXX_FLAGS /MDd CACHE STRING "")
- SET(DYNAMIC_LIBRARY_CXX_FLAGS /MDd CACHE STRING "")
- SET(D /D)
-
- add_definitions(/D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /D_WIN32 /D_WINDOWS /FS /D_WIN32_WINNT=0x0600)
- add_compile_options(/Zi /Od /EHsc /W4)
-else(MSVC)
- set(CMAKE_CXX_FLAGS_DEBUG " -Wall -ggdb -o0 ${CMAKE_CXX_FLAGS_DEBUG}")
-
- SET(STATIC_LIBRARY_CXX_FLAGS)
- SET(EXECUTABLE_CXX_FLAGS)
- SET(DYNAMIC_LIBRARY_CXX_FLAGS)
- SET(D -D)
- set(CMAKE_CXX_FLAGS " -std=c++11 -Wall -fPIC ${CMAKE_CXX_FLAGS} ")
- SET (CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS})
- #set(CMAKE_SHARED_LINKER_FLAGS "--no-undefined" )
+ add_definitions(-D_SCL_SECURE_NO_WARNINGS)
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+ add_definitions(-D_WIN32)
+ add_definitions(-D_WINDOWS)
+ add_definitions(-D_WIN32_WINNT=0x0600)
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
endif()
if(WIN32)
@@ -105,7 +74,7 @@ else(WIN32)
endif(WIN32)
-find_package( Boost COMPONENTS system program_options filesystem thread REQUIRED )
+find_package( Boost COMPONENTS system program_options filesystem thread date_time REQUIRED )
include_directories( ${Boost_INCLUDE_DIRS} )
link_directories( ${Boost_LIBRARY_DIRS} )
message(STATUS "Boost INCLUDE DIR IS: " ${Boost_INCLUDE_DIRS})
@@ -185,9 +154,6 @@ add_library(opcuaprotocol
src/protocol/subscriptions.cpp
)
-if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
- target_compile_options(opcuaprotocol PUBLIC ${STATIC_LIBRARY_CXX_FLAGS})
-endif ()
target_link_libraries(opcuaprotocol ${ADDITIONAL_LINK_LIBRARIES})
target_include_directories(opcuaprotocol PUBLIC $<INSTALL_INTERFACE:include>)
install(TARGETS opcuaprotocol EXPORT FreeOpcUa
@@ -227,10 +193,6 @@ if (BUILD_TESTING)
gtest_main
)
- if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
- target_compile_options(test_opcuaprotocol PUBLIC ${EXECUTABLE_CXX_FLAGS})
- endif ()
-
add_test(NAME opcuaprotocol COMMAND test_opcuaprotocol)
endif()
@@ -266,11 +228,7 @@ SET(opcuacore_SOURCES
add_library(opcuacore ${opcuacore_SOURCES})
-if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
- target_compile_options(opcuacore PUBLIC ${STATIC_LIBRARY_CXX_FLAGS})
-endif ()
-
-target_link_libraries(opcuacore ${ADDITIONAL_LINK_LIBRARIES} opcuaprotocol ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
+target_link_libraries(opcuacore ${ADDITIONAL_LINK_LIBRARIES} opcuaprotocol ${Boost_LIBRARIES})
target_include_directories(opcuacore PUBLIC $<INSTALL_INTERFACE:include>)
install(TARGETS opcuacore EXPORT FreeOpcUa
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -306,7 +264,7 @@ if (BUILD_TESTING)
)
if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
- target_compile_options(test_opcuacore PUBLIC ${D}DYNAMIC_ADDON_PATH="${DYNAMIC_ADDON_PATH}" ${D}TEST_CORE_CONFIG_PATH="${TEST_CORE_CONFIG_PATH}" ${EXECUTABLE_CXX_FLAGS})
+ target_compile_options(test_opcuacore PUBLIC ${D}DYNAMIC_ADDON_PATH="${DYNAMIC_ADDON_PATH}" ${D}TEST_CORE_CONFIG_PATH="${TEST_CORE_CONFIG_PATH}" )
endif ()
add_test(NAME opcuacore COMMAND test_opcuacore)
@@ -327,9 +285,6 @@ if (BUILD_CLIENT)
src/client/client.cpp
)
- if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
- target_compile_options(opcuaclient PUBLIC ${STATIC_LIBRARY_CXX_FLAGS})
- endif ()
target_link_libraries(opcuaclient
opcuacore
${ADDITIONAL_LINK_LIBRARIES}
@@ -371,9 +326,6 @@ if (BUILD_CLIENT)
opcuacore
)
- if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
- target_compile_options(opcuaclient PUBLIC ${EXECUTABLE_CXX_FLAGS})
- endif ()
endif(BUILD_CLIENT)
@@ -423,10 +375,7 @@ if(BUILD_SERVER)
src/server/subscription_service_internal.cpp
)
- if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
- target_compile_options(opcuaserver PUBLIC ${STATIC_LIBRARY_CXX_FLAGS})
- endif ()
- target_link_libraries(opcuaserver ${ADDITIONAL_LINK_LIBRARIES} opcuacore opcuaprotocol ${Boost_SYSTEM_LIBRARY})
+ target_link_libraries(opcuaserver ${ADDITIONAL_LINK_LIBRARIES} opcuacore opcuaprotocol ${Boost_LIBRARIES})
target_include_directories(opcuaserver PUBLIC $<INSTALL_INTERFACE:include>)
install(TARGETS opcuaserver EXPORT FreeOpcUa
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -481,7 +430,7 @@ if(BUILD_SERVER)
target_include_directories(test_opcuaserver PUBLIC .)
if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
- target_compile_options(test_opcuaserver PUBLIC ${D}TEST_CORE_CONFIG_PATH="${TEST_CORE_CONFIG_PATH}" ${STATIC_LIBRARY_CXX_FLAGS})
+ target_compile_options(test_opcuaserver PUBLIC ${D}TEST_CORE_CONFIG_PATH="${TEST_CORE_CONFIG_PATH}")
endif ()
add_test(NAME opcuaserverapp COMMAND test_opcuaserver)
@@ -510,9 +459,6 @@ if(BUILD_SERVER)
opcuaserver
${Boost_PROGRAM_OPTIONS_LIBRARY}
)
- if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
- target_compile_options(opcuaserverapp PUBLIC ${EXECUTABLE_CXX_FLAGS})
- endif ()
endif(BUILD_SERVER)
@@ -533,9 +479,6 @@ if (BUILD_CLIENT)
${SSL_SUPPORT_LINK_LIBRARIES}
)
- if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
- target_compile_options(example_client PUBLIC ${EXECUTABLE_CXX_FLAGS})
- endif ()
endif (BUILD_CLIENT)
@@ -555,9 +498,6 @@ if(BUILD_SERVER)
opcuaserver
)
- if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
- target_compile_options(example_server PUBLIC ${EXECUTABLE_CXX_FLAGS})
- endif ()
if(MSVC)
set_target_properties(example_server PROPERTIES LINK_FLAGS /STACK:3000000)
endif(MSVC)
@@ -572,7 +512,7 @@ if (BUILD_PYTHON)
add_subdirectory(python)
endif (BUILD_PYTHON)
-install(EXPORT FreeOpcUa DESTINATION lib/cmake/FreeOpcUa FILE FreeOpcUaConfig.cmake)
+install(EXPORT FreeOpcUa DESTINATION share/freeopcua FILE FreeOpcUaConfig.cmake)
SET(CPACK_GENERATOR "DEB")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "FreeOpcUa")