diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..af96791f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vscode +build diff --git a/.travis.yml b/.travis.yml index d46d9a5c..95a736eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -212,7 +212,7 @@ install: ####################################################################################### - | if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then - CMAKE_URL="http://www.cmake.org/files/v3.3/cmake-3.3.2-Linux-x86_64.tar.gz" + CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz" mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake export PATH=${DEPS_DIR}/cmake/bin:${PATH} else diff --git a/CMake/config.cmake b/CMake/config.cmake index dcb624d3..a6680601 100644 --- a/CMake/config.cmake +++ b/CMake/config.cmake @@ -40,30 +40,68 @@ set(README_FILE "${CMAKE_SOURCE_DIR}/README.md") set(LICENSE_FILE "${CMAKE_SOURCE_DIR}/LICENSE.txt") # dirs where the binaries should be placed, installed -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") set(CMAKE_EXECUTABLE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") -set(RTTR_INSTALL_DIR "${CMAKE_BINARY_DIR}/install") + +# here we specify the installation directory +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/install" CACHE PATH "RTTR install prefix" FORCE) +endif() # in order to group in visual studio the targets into solution filters -set_property( GLOBAL PROPERTY USE_FOLDERS ON) +set_property(GLOBAL PROPERTY USE_FOLDERS ON) #3rd part dependencies dirs set(RTTR_3RD_PARTY_DIR "${CMAKE_SOURCE_DIR}/3rd_party") getNameOfDir(CMAKE_LIBRARY_OUTPUT_DIRECTORY RTTR_TARGET_BIN_DIR) is_vs_based_build(VS_BUILD) -if (VS_BUILD) - #set(RTTR_BIN_INSTALL_DIR ${RTTR_TARGET_BIN_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}) - set(RTTR_BIN_INSTALL_DIR ${RTTR_TARGET_BIN_DIR}) - set(RTTR_LIB_INSTALL_DIR "lib") -else() - set(RTTR_BIN_INSTALL_DIR ${RTTR_TARGET_BIN_DIR}) - set(RTTR_LIB_INSTALL_DIR "lib") + +# set all install directories for the targets +if(UNIX) + include(GNUInstallDirs) + set(RTTR_RUNTIME_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}") + set(RTTR_LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") + set(RTTR_ARCHIVE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") + set(RTTR_FRAMEWORK_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") + + set(RTTR_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}") + + set(RTTR_CMAKE_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/rttr/cmake") + set(RTTR_ADDITIONAL_FILES_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/rttr") + +else(WINDOWS) + set(RTTR_RUNTIME_INSTALL_DIR "bin") + set(RTTR_LIBRARY_INSTALL_DIR "bin") + set(RTTR_ARCHIVE_INSTALL_DIR "lib") + set(RTTR_FRAMEWORK_INSTALL_DIR "bin") + + set(RTTR_CMAKE_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/cmake") + set(RTTR_ADDITIONAL_FILES_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}") endif() set(CMAKE_DEBUG_POSTFIX "_d") +# set the rpath for executables +set(CMAKE_SKIP_BUILD_RPATH OFF) # use, i.e. don't skip the full RPATH for the build tree +set(CMAKE_BUILD_WITH_INSTALL_RPATH OFF) # when building, don't use the install RPATH already (but later on when installing) +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF) # NO automatic rpath for INSTALL +if(APPLE) + set(MACOSX_RPATH ON CACHE STRING "Set this to off if you dont want @rpath in install names") # uses a install name @rpath/... for libraries + set(RTTR_EXECUTABLE_INSTALL_RPATH "${RTTR_INSTALL_FULL_LIBDIR};@executable_path") + # the executable is relocatable, since the library builds with and install name "@rpath/librttr_core.0.9.6.dylib" + # the executable links +elseif(UNIX) + set(RTTR_EXECUTABLE_INSTALL_RPATH "${RTTR_INSTALL_FULL_LIBDIR};$ORIGIN") +elseif(WINDOWS) + # no such thin as rpath exists, + set(RTTR_EXECUTABLE_INSTALL_RPATH ${RTTR_INSTALL_BINDIR}) # default, has no effect +endif() + + + # detect architecture if (CMAKE_SIZEOF_VOID_P EQUAL 8) set(RTTR_NATIVE_ARCH 64) @@ -100,7 +138,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") message(WARNING "clang support is currently experimental") - set(CLANG_STATIC_LINKER_FLAGS "-stdlib=libstdc++ -static -lstdc++") + set(CLANG_STATIC_LINKER_FLAGS "-stdlib=libc++ -static-libstdc++") endif() if(MSVC) @@ -134,10 +172,10 @@ write_basic_package_version_file( if (BUILD_INSTALLER) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/CMake/rttr-config-version.cmake" - DESTINATION cmake + DESTINATION ${RTTR_CMAKE_CONFIG_INSTALL_DIR} COMPONENT Devel) install(FILES "${LICENSE_FILE}" "${README_FILE}" - DESTINATION "." - PERMISSIONS OWNER_READ) + DESTINATION ${RTTR_ADDITIONAL_FILES_INSTALL_DIR} + PERMISSIONS OWNER_READ) endif() diff --git a/CMake/utility.cmake b/CMake/utility.cmake index ec567a73..31d9cde7 100644 --- a/CMake/utility.cmake +++ b/CMake/utility.cmake @@ -504,5 +504,4 @@ macro(generateLibraryVersionVariables MAJOR MINOR PATCH PRODUCT_NAME PRODUCT_CPY set(LIBRARY_PRODUCT_NAME ${PRODUCT_NAME}) set(LIBRARY_COPYRIGHT ${PRODUCT_CPY_RIGHT}) set(LIBRARY_LICENSE ${PRODUCT_LICENSE}) -endmacro() - +endmacro() \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index bd834503..a15d5916 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ # the build configuration options are initialized. # #################################################################################### -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.0) project ("rttr") @@ -85,8 +85,3 @@ add_subdirectory(src) if (BUILD_DOCUMENTATION) add_subdirectory(doc) endif() - -# here we specify the installation directory -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX ${RTTR_INSTALL_DIR} CACHE PATH "RTTR install prefix" FORCE) -endif() diff --git a/src/benchmarks/bench_method/CMakeLists.txt b/src/benchmarks/bench_method/CMakeLists.txt index 8b543a41..cfb09d6a 100644 --- a/src/benchmarks/bench_method/CMakeLists.txt +++ b/src/benchmarks/bench_method/CMakeLists.txt @@ -55,11 +55,15 @@ if(MSVC) endif() set_target_properties(bench_method PROPERTIES DEBUG_POSTFIX _d - FOLDER "Benchmarks") + FOLDER "Benchmarks" + INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}") add_dependencies(bench_method RTTR::Core) install(TARGETS bench_method - RUNTIME DESTINATION ${RTTR_BIN_INSTALL_DIR}) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) ############################################################################### @@ -78,12 +82,16 @@ if (BUILD_STATIC) endif() set_target_properties(bench_method_lib PROPERTIES DEBUG_POSTFIX _d - FOLDER "Benchmarks") + FOLDER "Benchmarks" + INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}") add_dependencies(bench_method_lib RTTR::Core_Lib) install(TARGETS bench_method_lib - RUNTIME DESTINATION ${RTTR_BIN_INSTALL_DIR}) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) endif() ############################################################################### @@ -103,8 +111,9 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) endif() set_target_properties(bench_method_s PROPERTIES DEBUG_POSTFIX _d - FOLDER "Benchmarks") - + FOLDER "Benchmarks" + INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}") + add_dependencies(bench_method_s RTTR::Core_STL) if (MSVC) @@ -118,7 +127,10 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) endif() install(TARGETS bench_method_s - RUNTIME DESTINATION ${RTTR_BIN_INSTALL_DIR}) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) if (BUILD_STATIC) add_executable(bench_method_lib_s ${SRC_FILES} ${HPP_FILES}) @@ -135,7 +147,8 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) endif() set_target_properties(bench_method_lib_s PROPERTIES DEBUG_POSTFIX _d - FOLDER "Benchmarks") + FOLDER "Benchmarks" + INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}") add_dependencies(bench_method_lib_s RTTR::Core_Lib_STL) @@ -150,7 +163,10 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) endif() install(TARGETS bench_method_lib_s - RUNTIME DESTINATION ${RTTR_BIN_INSTALL_DIR}) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) endif() endif() diff --git a/src/benchmarks/bench_rttr_cast/CMakeLists.txt b/src/benchmarks/bench_rttr_cast/CMakeLists.txt index 6f73f3fe..047b27dd 100644 --- a/src/benchmarks/bench_rttr_cast/CMakeLists.txt +++ b/src/benchmarks/bench_rttr_cast/CMakeLists.txt @@ -53,14 +53,17 @@ target_compile_definitions(bench_rttr_cast PUBLIC BOOST_ALL_NO_LIB) if(MSVC) set_target_properties(bench_rttr_cast PROPERTIES COMPILE_FLAGS "/Zm200") endif() - set_target_properties(bench_rttr_cast PROPERTIES DEBUG_POSTFIX _d - FOLDER "Benchmarks") + FOLDER "Benchmarks" + INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}") add_dependencies(bench_rttr_cast RTTR::Core) install(TARGETS bench_rttr_cast - RUNTIME DESTINATION ${RTTR_BIN_INSTALL_DIR} ) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) ############################################################################### @@ -79,12 +82,16 @@ if (BUILD_STATIC) endif() set_target_properties(bench_rttr_cast_lib PROPERTIES DEBUG_POSTFIX _d - FOLDER "Benchmarks") + FOLDER "Benchmarks" + INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}") add_dependencies(bench_rttr_cast_lib RTTR::Core_Lib) install(TARGETS bench_rttr_cast_lib - RUNTIME DESTINATION ${RTTR_BIN_INSTALL_DIR}) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) endif() ############################################################################### @@ -104,7 +111,8 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) endif() set_target_properties(bench_rttr_cast_s PROPERTIES DEBUG_POSTFIX _d - FOLDER "Benchmarks") + FOLDER "Benchmarks" + INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}") add_dependencies(bench_rttr_cast_s RTTR::Core_STL) @@ -119,7 +127,10 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) endif() install(TARGETS bench_rttr_cast_s - RUNTIME DESTINATION ${RTTR_BIN_INSTALL_DIR}) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) if (BUILD_STATIC) add_executable(bench_rttr_cast_lib_s ${SRC_FILES} ${HPP_FILES}) @@ -136,7 +147,8 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) endif() set_target_properties(bench_rttr_cast_lib_s PROPERTIES DEBUG_POSTFIX _d - FOLDER "Benchmarks") + FOLDER "Benchmarks" + INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}") add_dependencies(bench_rttr_cast_lib_s RTTR::Core_Lib_STL) @@ -151,7 +163,10 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) endif() install(TARGETS bench_rttr_cast_lib_s - RUNTIME DESTINATION ${RTTR_BIN_INSTALL_DIR}) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) endif() endif() diff --git a/src/benchmarks/bench_variant/CMakeLists.txt b/src/benchmarks/bench_variant/CMakeLists.txt index 868c0083..34a62452 100644 --- a/src/benchmarks/bench_variant/CMakeLists.txt +++ b/src/benchmarks/bench_variant/CMakeLists.txt @@ -55,12 +55,16 @@ if(MSVC) endif() set_target_properties(bench_variant PROPERTIES DEBUG_POSTFIX _d - FOLDER "Benchmarks") + FOLDER "Benchmarks" + INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}") add_dependencies(bench_variant RTTR::Core) install(TARGETS bench_variant - RUNTIME DESTINATION ${RTTR_BIN_INSTALL_DIR}) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) ############################################################################### @@ -79,12 +83,16 @@ if (BUILD_STATIC) endif() set_target_properties(bench_variant_lib PROPERTIES DEBUG_POSTFIX _d - FOLDER "Benchmarks") + FOLDER "Benchmarks" + INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}") add_dependencies(bench_variant_lib RTTR::Core_Lib) install(TARGETS bench_variant_lib - RUNTIME DESTINATION ${RTTR_BIN_INSTALL_DIR}) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) endif() ############################################################################### @@ -104,7 +112,8 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) endif() set_target_properties(bench_variant_s PROPERTIES DEBUG_POSTFIX _d - FOLDER "Benchmarks") + FOLDER "Benchmarks" + INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}") add_dependencies(bench_variant_s RTTR::Core_STL) @@ -119,7 +128,10 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) endif() install(TARGETS bench_variant_s - RUNTIME DESTINATION ${RTTR_BIN_INSTALL_DIR}) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) if (BUILD_STATIC) add_executable(bench_variant_lib_s ${SRC_FILES} ${HPP_FILES}) @@ -136,7 +148,8 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) endif() set_target_properties(bench_variant_lib_s PROPERTIES DEBUG_POSTFIX _d - FOLDER "Benchmarks") + FOLDER "Benchmarks" + INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}") add_dependencies(bench_variant_lib_s RTTR::Core_Lib_STL) @@ -151,7 +164,10 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) endif() install(TARGETS bench_variant_lib_s - RUNTIME DESTINATION ${RTTR_BIN_INSTALL_DIR}) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) endif() endif() diff --git a/src/examples/json_serialization/CMakeLists.txt b/src/examples/json_serialization/CMakeLists.txt index 5c08c683..99679069 100644 --- a/src/examples/json_serialization/CMakeLists.txt +++ b/src/examples/json_serialization/CMakeLists.txt @@ -43,7 +43,8 @@ add_executable(json_serialization ${SRC_FILES} ${HPP_FILES}) target_link_libraries(json_serialization RTTR::Core) target_include_directories(json_serialization PUBLIC ${RAPID_JSON_DIR}) set_target_properties(json_serialization PROPERTIES DEBUG_POSTFIX _d - FOLDER "Examples") + FOLDER "Examples" + INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}") message(STATUS "Scanning " ${PROJECT_NAME} " module finished!") diff --git a/src/rttr/CMakeLists.txt b/src/rttr/CMakeLists.txt index c21f7ed8..3addb3f7 100644 --- a/src/rttr/CMakeLists.txt +++ b/src/rttr/CMakeLists.txt @@ -48,7 +48,8 @@ if (${BUILD_RTTR_DYNAMIC}) set_target_properties(rttr_core PROPERTIES VERSION ${RTTR_VERSION} SOVERSION ${RTTR_VERSION} - EXPORT_NAME Core) + EXPORT_NAME Core + DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) target_include_directories(rttr_core PUBLIC $ @@ -57,12 +58,13 @@ if (${BUILD_RTTR_DYNAMIC}) if (BUILD_INSTALLER) install(TARGETS rttr_core EXPORT rttr_targets - RUNTIME DESTINATION ${RTTR_BIN_INSTALL_DIR} - LIBRARY DESTINATION ${RTTR_BIN_INSTALL_DIR} - ARCHIVE DESTINATION ${RTTR_LIB_INSTALL_DIR}) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) install(EXPORT rttr_targets - DESTINATION cmake + DESTINATION ${RTTR_CMAKE_CONFIG_INSTALL_DIR} NAMESPACE RTTR:: FILE rttr-config.cmake) @@ -78,7 +80,8 @@ if (BUILD_STATIC) set_target_properties(rttr_core_lib PROPERTIES VERSION ${RTTR_VERSION} SOVERSION ${RTTR_VERSION} - EXPORT_NAME Core_Lib) + EXPORT_NAME Core_Lib + DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) if (MSVC) set_target_properties(rttr_core_lib PROPERTIES OUTPUT_NAME librttr_core) elseif (CMAKE_COMPILER_IS_GNUCXX) @@ -90,14 +93,16 @@ if (BUILD_STATIC) endif() target_include_directories(rttr_core_lib PUBLIC - $ - $ - $) + $ + $ + $) if (BUILD_INSTALLER) install(TARGETS rttr_core_lib EXPORT rttr_targets - ARCHIVE DESTINATION ${RTTR_LIB_INSTALL_DIR} - LIBRARY DESTINATION ${RTTR_LIB_INSTALL_DIR}) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) endif() endif() @@ -115,7 +120,8 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) set_target_properties(rttr_core_s PROPERTIES VERSION ${RTTR_VERSION} SOVERSION ${RTTR_VERSION} - EXPORT_NAME Core_STL) + EXPORT_NAME Core_STL + DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) if (MSVC) target_compile_options(rttr_core_s PUBLIC "/MT$<$:d>") @@ -130,9 +136,10 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) if (BUILD_INSTALLER) install_pdb_files(rttr_core_s) install(TARGETS rttr_core_s EXPORT rttr_targets - RUNTIME DESTINATION ${RTTR_BIN_INSTALL_DIR} - LIBRARY DESTINATION ${RTTR_BIN_INSTALL_DIR} - ARCHIVE DESTINATION ${RTTR_LIB_INSTALL_DIR}) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) endif() if (BUILD_STATIC) @@ -146,7 +153,8 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) set_target_properties(rttr_core_lib_s PROPERTIES VERSION ${RTTR_VERSION} SOVERSION ${RTTR_VERSION} - EXPORT_NAME Core_Lib_STL) + EXPORT_NAME Core_Lib_STL + DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) if (MSVC) target_compile_options(rttr_core_lib_s PUBLIC "/MT$<$:d>") set_target_properties(rttr_core_lib PROPERTIES OUTPUT_NAME librttr_core_s) @@ -160,8 +168,10 @@ if (BUILD_WITH_STATIC_RUNTIME_LIBS) if (BUILD_INSTALLER) install(TARGETS rttr_core_lib_s EXPORT rttr_targets - ARCHIVE DESTINATION ${RTTR_LIB_INSTALL_DIR} - LIBRARY DESTINATION ${RTTR_LIB_INSTALL_DIR}) + RUNTIME DESTINATION ${RTTR_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${RTTR_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${RTTR_ARCHIVE_INSTALL_DIR} + FRAMEWORK DESTINATION ${RTTR_FRAMEWORK_INSTALL_DIR}) endif() endif() diff --git a/src/unit_tests/CMakeLists.txt b/src/unit_tests/CMakeLists.txt index 787e08ba..d235cbc6 100644 --- a/src/unit_tests/CMakeLists.txt +++ b/src/unit_tests/CMakeLists.txt @@ -43,7 +43,8 @@ add_executable(unit_tests ${SRC_FILES} ${HPP_FILES}) target_link_libraries(unit_tests RTTR::Core) add_dependencies(unit_tests RTTR::Core) target_include_directories(unit_tests PUBLIC ${CATCH_DIR}) -set_target_properties(unit_tests PROPERTIES DEBUG_POSTFIX _d) +set_target_properties(unit_tests PROPERTIES DEBUG_POSTFIX _d + INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}") # run tests add_custom_target(run_tests ALL