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

Fix cmake problem about MinGW-Compile. #5663

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ endif()
###############################################################################
# Tools default setup
###############################################################################
set(MINGW_COMPILE FALSE)
if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
Expand All @@ -407,7 +408,7 @@ if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_definitions(-DMINGW_COMPILER=1)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wno-attributes -Wno-stringop-overread -Wno-builtin-macro-redefined -Wno-cast-function-type -Wno-unused-variable -Wno-unused-parameter -Wno-unused-function -Wno-missing-field-initializers")
target_link_libraries(fastdds PUBLIC ws2_32 mswsock)
set(MINGW_COMPILE TRUE)
else()
message(STATUS "Using a GNU compiler on Windows but not MinGW.")
endif()
Expand All @@ -429,6 +430,9 @@ option(FASTDDS_STATISTICS "Enable Fast DDS Statistics Module" ON)
# Compile library.
###############################################################################
add_subdirectory(src/cpp)
if(MINGW_COMPILE)
target_link_libraries(fastdds PUBLIC ws2_32 mswsock)
endif()

###############################################################################
# Add http://optionparser.sourceforge.net/ as unified cli parser
Expand Down