Commit eb22d4b2 authored by Ghislain MARY's avatar Ghislain MARY

Fix compilation with CMake on Windows.

parent ced9c769
......@@ -117,12 +117,15 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}/src
)
add_definitions(-DHAVE_CONFIG_H -Wall -Werror -Wno-error=unknown-pragmas)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
add_definitions(-Wno-error=unknown-warning-option)
elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
add_definitions(-Wno-error=pragmas)
endif()
add_definitions(-DHAVE_CONFIG_H)
if(NOT MSVC)
add_definitions(-Wall -Wno-error=unknown-pragmas)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
add_definitions(-Werror -Wno-error=unknown-warning-option)
elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
add_definitions(-Werror -Wno-error=pragmas)
endif()
endif(NOT MSVC)
if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set(LINK_FLAGS "${LINK_FLAGS} -framework CoreFoundation -framework CFNetwork")
endif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
......
......@@ -24,9 +24,9 @@ set(INCLUDES ${ANTLR3C_INCLUDE_DIR})
set(LIBS ${ANTLR3C_LIBRARIES})
if(${Threads_FOUND})
if(${CMAKE_USE_PTHREADS_INIT} AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "QNX")
if(CMAKE_USE_PTHREADS_INIT AND NOT CMAKE_SYSTEM_NAME MATCHES "QNX")
list(APPEND LIBS pthread)
endif(${CMAKE_USE_PTHREADS_INIT} AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "QNX")
endif(CMAKE_USE_PTHREADS_INIT AND NOT CMAKE_SYSTEM_NAME MATCHES "QNX")
endif(${Threads_FOUND})
if(${HAVE_LIBDL})
list(APPEND LIBS dl)
......@@ -34,6 +34,9 @@ endif(${HAVE_LIBDL})
if(${HAVE_RESINIT})
list(APPEND LIBS resolv)
endif(${HAVE_RESINIT})
if(WIN32)
list(APPEND LIBS ws2_32)
endif(WIN32)
set(SDP_GENERATED_SOURCE_FILES
${CMAKE_CURRENT_BINARY_DIR}/grammars/belle_sdpLexer.c
......@@ -145,7 +148,7 @@ else(${ENABLE_STATIC})
endif()
endif(MSVC)
endif(${ENABLE_STATIC})
set_target_properties(bellesip PROPERTIES LINK_FLAGS ${LINK_FLAGS})
set_target_properties(bellesip PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
target_include_directories(bellesip PUBLIC ${INCLUDES})
target_link_libraries(bellesip ${LIBS})
......
......@@ -40,7 +40,7 @@ set(TESTER_SOURCES
)
add_executable(belle_sip_tester ${TESTER_SOURCES})
set_target_properties(belle_sip_tester PROPERTIES LINK_FLAGS ${LINK_FLAGS})
set_target_properties(belle_sip_tester PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
target_include_directories(belle_sip_tester PUBLIC ${CUNIT_INCLUDE_DIR})
target_link_libraries(belle_sip_tester ${CUNIT_LIBRARIES} bellesip)
add_test(NAME belle_sip_tester COMMAND belle_sip_tester --verbose)
......@@ -49,13 +49,13 @@ add_test(NAME belle_sip_tester COMMAND belle_sip_tester --verbose)
set(OBJECT_DESCRIBE_SOURCES describe.c)
add_executable(belle_sip_object_describe ${OBJECT_DESCRIBE_SOURCES})
set_target_properties(belle_sip_object_describe PROPERTIES LINK_FLAGS ${LINK_FLAGS})
set_target_properties(belle_sip_object_describe PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
target_link_libraries(belle_sip_object_describe bellesip)
set(PARSE_SOURCES parse.c)
add_executable(belle_sip_parse ${PARSE_SOURCES})
set_target_properties(belle_sip_parse PROPERTIES LINK_FLAGS ${LINK_FLAGS})
set_target_properties(belle_sip_parse PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
target_link_libraries(belle_sip_parse bellesip)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment