Skip to content
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

[11498] updating scripts for CMake 3.17 #1951

Merged
merged 4 commits into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmake/packaging/windows/fastrtps-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,18 @@ if(MSVC_VERSION EQUAL 1900)
else()
include("${CMAKE_CURRENT_LIST_DIR}/../share/fastrtps-i86Win32VS2015/cmake/fastrtps-config.cmake")
endif()
elseif(MSVC_VERSION GREATER 1900)
elseif(MSVC_VERSION LESS 1920)
if(CMAKE_CL_64)
include("${CMAKE_CURRENT_LIST_DIR}/../share/fastrtps-x64Win64VS2017/cmake/fastrtps-config.cmake")
else()
include("${CMAKE_CURRENT_LIST_DIR}/../share/fastrtps-i86Win32VS2017/cmake/fastrtps-config.cmake")
endif()
elseif(MSVC_VERSION GREATER_EQUAL 1920)
if(CMAKE_CL_64)
include("${CMAKE_CURRENT_LIST_DIR}/../share/fastrtps-x64Win64VS2019/cmake/fastrtps-config.cmake")
else()
include("${CMAKE_CURRENT_LIST_DIR}/../share/fastrtps-i86Win32VS2019/cmake/fastrtps-config.cmake")
endif()
else()
message(FATAL_ERROR "Not supported version of Visual Studio")
endif()
37 changes: 26 additions & 11 deletions src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,17 @@ elseif(NOT EPROSIMA_INSTALLER)
if(TARGET_TYPE STREQUAL "SHARED_LIBRARY")
# Export symbols in DLL library
target_compile_definitions(${PROJECT_NAME} PUBLIC ${PROJECT_NAME_UPPER}_DYN_LINK)
set_target_properties(${PROJECT_NAME} PROPERTIES
PDB_NAME_DEBUG "${PROJECT_NAME}d-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
PDB_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_BINARY_DIR}/symbols"
)
else()
# Rename the library to have a "lib" before.
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME lib${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES
COMPILE_PDB_NAME_DEBUG "lib${PROJECT_NAME}d-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
COMPILE_PDB_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_BINARY_DIR}/symbols"
)
endif()

if("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
Expand Down Expand Up @@ -594,19 +602,26 @@ elseif(NOT EPROSIMA_INSTALLER)
)

if(MSVC OR MSVC_IDE)
if(TARGET_TYPE STREQUAL "SHARED_LIBRARY")
# Install pdb files
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Debug/
DESTINATION ${LIB_INSTALL_DIR}${MSVCARCH_DIR_EXTENSION}
COMPONENT libraries${MSVCARCH_EXTENSION}
CONFIGURATIONS Debug
FILES_MATCHING
PATTERN "*.pdb"
)

# first try dll symbols
get_target_property(PDB_FILE ${PROJECT_NAME} PDB_NAME_DEBUG)
if(PDB_FILE)
get_target_property(PDB_DIR ${PROJECT_NAME} PDB_OUTPUT_DIRECTORY_DEBUG)
set(PDB_FILE "${PDB_DIR}/${PDB_FILE}.pdb")
else()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.dir/Debug/${PROJECT_NAME}.pdb
# fallback to static lib symbols
get_target_property(PDB_FILE ${PROJECT_NAME} COMPILE_PDB_NAME_DEBUG)
if(PDB_FILE)
get_target_property(PDB_DIR ${PROJECT_NAME} COMPILE_PDB_OUTPUT_DIRECTORY_DEBUG)
set(PDB_FILE "${PDB_DIR}/${PDB_FILE}.pdb")
endif()
endif()

# install symbols if any
if(PDB_FILE)
install(FILES ${PDB_FILE}
DESTINATION ${LIB_INSTALL_DIR}${MSVCARCH_DIR_EXTENSION}
COMPONENT libraries${MSVCARCH_EXTENSION}
COMPONENT symbols
CONFIGURATIONS Debug
)
endif()
Expand Down