message: fixed - decided to generate the final header only when doctest is NOT added as a cmake subtree with add_subdirectory but is used directly
diff: @@ -12,26 +12,15 @@ option(DOCTEST_NO_INSTALL "Skip the installation process" OFF)
  add_library(${PROJECT_NAME} INTERFACE)
  -# use a special hidden version of the doctest header which directly includes the 2 parts - much easier during development
  +set(doctest_parts_folder "${CMAKE_CURRENT_SOURCE_DIR}/doctest/parts")
  +
  if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
  - message("using the DEV version!")
  + # use a special hidden version of the doctest header which directly includes the 2 parts - much easier during development
  target_include_directories(${PROJECT_NAME} INTERFACE
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/scripts/development_only/>
  - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/doctest/parts/>)
  -else()
  - target_include_directories(${PROJECT_NAME} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>)
  -endif()
  -
  -# hack to support building on XCode 6 and 7 - propagate the definition to everything
  -if(DEFINED DOCTEST_THREAD_LOCAL)
  - target_compile_definitions(${PROJECT_NAME} INTERFACE
  - DOCTEST_THREAD_LOCAL=${DOCTEST_THREAD_LOCAL})
  -endif()
  + $<BUILD_INTERFACE:${doctest_parts_folder}>)
  # add a custom target that assembles the single header when any of the parts are touched
  -
  -set(doctest_parts_folder "${CMAKE_CURRENT_SOURCE_DIR}/doctest/parts")
  -
  add_custom_command(
  OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/doctest/doctest.h
  DEPENDS
  @@ -41,13 +30,22 @@ add_custom_command(
  COMMENT "assembling the single header")
  add_custom_target(assemble_single_header ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/doctest/doctest.h)
  +else()
  + target_include_directories(${PROJECT_NAME} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>)
  +endif()
  +
  +# hack to support building on XCode 6 and 7 - propagate the definition to everything
  +if(DEFINED DOCTEST_THREAD_LOCAL)
  + target_compile_definitions(${PROJECT_NAME} INTERFACE
  + DOCTEST_THREAD_LOCAL=${DOCTEST_THREAD_LOCAL})
  +endif()
  ################################################################################
  ## TESTS/EXAMPLES/HELPERS
  ################################################################################
  if(${DOCTEST_WITH_MAIN_IN_STATIC_LIB})
  - add_library(${PROJECT_NAME}_with_main STATIC EXCLUDE_FROM_ALL doctest/parts/doctest.cpp)
  + add_library(${PROJECT_NAME}_with_main STATIC EXCLUDE_FROM_ALL ${doctest_parts_folder}/doctest.cpp)
  target_compile_definitions(${PROJECT_NAME}_with_main PRIVATE
  DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN)
  target_link_libraries(${PROJECT_NAME}_with_main PUBLIC ${PROJECT_NAME})
  