Skip to content

Commit

Permalink
CMake参数互斥检测
Browse files Browse the repository at this point in the history
  • Loading branch information
test committed Jan 23, 2016
1 parent f521d13 commit fba60e0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ if (ENABLE_SHARED_STACK)
add_definitions(-DENABLE_SHARED_STACK)
endif()

# 选项互斥检查
if (UNIX)
# unix like platforms
aux_source_directory(${PROJECT_SOURCE_DIR}/src/linux CO_SRC_LIST)
Expand All @@ -31,6 +32,10 @@ if (UNIX)
set(CXX_FLAGS_POSTFIX "-fsplit-stack -DBOOST_USE_SEGMENTED_STACKS")
set(TEST_LINK_FLAGS "-fuse-ld=gold")
endif()

if (ENABLE_SHARED_STACK)
message(FATAL_ERROR "ENABLE_SHARED_STACK cannot used with ENABLE_BOOST_COROUTINE")
endif()
else ()
aux_source_directory(${PROJECT_SOURCE_DIR}/src/ctx_ucontext CO_SRC_LIST)
if (ENABLE_SEGMENTED_STACK)
Expand All @@ -53,10 +58,15 @@ elseif (WIN32)

if (ENABLE_BOOST_COROUTINE)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/ctx_boost_coroutine CO_SRC_LIST)
message(WARNING "boost.coroutine was unstable in windows platform")
else()
aux_source_directory(${PROJECT_SOURCE_DIR}/src/ctx_win_fiber CO_SRC_LIST)
endif()

if (ENABLE_SHARED_STACK)
message(FATAL_ERROR "ENABLE_SHARED_STACK depends unix like platforms")
endif()

if (ENABLE_SEGMENTED_STACK)
message(FATAL_ERROR "ENABLE_SEGMENTED_STACK depends unix like platforms")
endif()
Expand Down

0 comments on commit fba60e0

Please sign in to comment.