diff --git a/CMakeLists.txt b/CMakeLists.txt index 10ccf7a..dcce983 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ project(v4l2rtspserver) option(COVERAGE "Coverage" OFF) set(ALSA ON CACHE BOOL "use ALSA if available") +set(STATICSTDCPP ON CACHE BOOL "use gcc static lib if available") set(LOG4CPP OFF CACHE BOOL "use log4cpp if available") set(LIVE555URL http://www.live555.com/liveMedia/public/live555-latest.tar.gz CACHE STRING "live555 url") set(LIVE555CFLAGS -DBSD=1 -DSOCKLEN_T=socklen_t -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -DALLOW_RTSP_SERVER_PORT_REUSE=1 CACHE STRING "live555 CFGLAGS") @@ -118,14 +119,16 @@ include_directories("libv4l2cpp/inc") target_link_libraries (${PROJECT_NAME} libv4l2cpp) # static link of stdc++ if available -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-static-libgcc" CXX_SUPPORTS_STATIC_LIBGCC) -if (CXX_SUPPORTS_STATIC_LIBGCC) - target_link_libraries (${CMAKE_PROJECT_NAME} -static-libgcc) -endif() -CHECK_CXX_COMPILER_FLAG("-static-libstdc++" CXX_SUPPORTS_STATIC_LIBSTDCPP) -if (CXX_SUPPORTS_STATIC_LIBSTDCPP) - target_link_libraries (${CMAKE_PROJECT_NAME} -static-libstdc++) +if (STATICSTDCPP) + include(CheckCXXCompilerFlag) + CHECK_CXX_COMPILER_FLAG("-static-libgcc" CXX_SUPPORTS_STATIC_LIBGCC) + if (CXX_SUPPORTS_STATIC_LIBGCC) + target_link_libraries (${CMAKE_PROJECT_NAME} -static-libgcc) + endif() + CHECK_CXX_COMPILER_FLAG("-static-libstdc++" CXX_SUPPORTS_STATIC_LIBSTDCPP) + if (CXX_SUPPORTS_STATIC_LIBSTDCPP) + target_link_libraries (${CMAKE_PROJECT_NAME} -static-libstdc++) + endif() endif() #testing