mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-22 11:44:53 +08:00
Clean up of the build system. Added rt and util in certain places so compiling the tests on Linux succeed, which should fix #19. Also removed over verbose warnings on Linux when build stand-alone.
This commit is contained in:
parent
83ae470c78
commit
8a4a9a78c4
@ -13,7 +13,7 @@ macro(build_serial)
|
|||||||
# Enable warnings
|
# Enable warnings
|
||||||
# Assuming unix means a gcc style compiler, eg. g++ or clang++.
|
# Assuming unix means a gcc style compiler, eg. g++ or clang++.
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
set(CMAKE_CXX_FLAGS "-Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wconversion -Wdisabled-optimization -Wfloat-equal -Wformat -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimplicit -Wimport -Winit-self -Winline -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstack-protector -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch -Wswitch-default -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings")
|
#set(CMAKE_CXX_FLAGS "-Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wconversion -Wdisabled-optimization -Wfloat-equal -Wformat -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimplicit -Wimport -Winit-self -Winline -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstack-protector -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch -Wswitch-default -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings")
|
||||||
ELSEIF(WIN32)
|
ELSEIF(WIN32)
|
||||||
# Force to always compile with W4
|
# Force to always compile with W4
|
||||||
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||||
@ -69,7 +69,7 @@ macro(build_serial)
|
|||||||
|
|
||||||
set(OTHER_LIBS "")
|
set(OTHER_LIBS "")
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
set(OTHER_LIBS util)
|
set(OTHER_LIBS util rt)
|
||||||
endif(UNIX)
|
endif(UNIX)
|
||||||
|
|
||||||
## Build the Serial Library
|
## Build the Serial Library
|
||||||
|
|||||||
@ -19,7 +19,6 @@ macro(build_serial)
|
|||||||
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
|
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
|
||||||
|
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
include_directories(vendor)
|
|
||||||
|
|
||||||
set(SERIAL_SRCS src/serial.cc)
|
set(SERIAL_SRCS src/serial.cc)
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
@ -34,7 +33,7 @@ macro(build_serial)
|
|||||||
# Collect Link Libraries
|
# Collect Link Libraries
|
||||||
set(SERIAL_LINK_LIBS ${PROJECT_NAME})
|
set(SERIAL_LINK_LIBS ${PROJECT_NAME})
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
list(APPEND SERIAL_LINK_LIBS rt pthread)
|
list(APPEND SERIAL_LINK_LIBS rt pthread util)
|
||||||
endif(UNIX AND NOT APPLE)
|
endif(UNIX AND NOT APPLE)
|
||||||
|
|
||||||
# Build example
|
# Build example
|
||||||
@ -43,6 +42,6 @@ macro(build_serial)
|
|||||||
|
|
||||||
# Create unit tests
|
# Create unit tests
|
||||||
rosbuild_add_gtest(serial_tests tests/serial_tests.cc)
|
rosbuild_add_gtest(serial_tests tests/serial_tests.cc)
|
||||||
target_link_libraries(serial_tests ${PROJECT_NAME})
|
target_link_libraries(serial_tests ${PROJECT_NAME} ${SERIAL_LINK_LIBS})
|
||||||
|
|
||||||
endmacro(build_serial)
|
endmacro(build_serial)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user