diff --git a/Installation/demo/CMakeLists.txt b/Installation/demo/CMakeLists.txt index 0b72f7b2149..183121698b8 100644 --- a/Installation/demo/CMakeLists.txt +++ b/Installation/demo/CMakeLists.txt @@ -18,9 +18,10 @@ foreach( entry ${list} ) message( STATUS "Configuring demo in ${entry}" ) + string( REGEX REPLACE "${CMAKE_SOURCE_DIR}/*/demo/" "" DEMO_DIR "${entry}" ) + if( NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") # out-of-source - string( REGEX REPLACE "${CMAKE_SOURCE_DIR}/*/demo/" "" DEMO_DIR "${entry}" ) - make_directory(${CMAKE_BINARY_DIR}/demo/${DEMO_DIR}) + make_directory(${CMAKE_BINARY_DIR}/demo/${DEMO_DIR}) endif() set(ADD_SUBDIR TRUE) diff --git a/Installation/examples/CMakeLists.txt b/Installation/examples/CMakeLists.txt index 8f75ddfbd16..eb651cae0a5 100644 --- a/Installation/examples/CMakeLists.txt +++ b/Installation/examples/CMakeLists.txt @@ -18,9 +18,10 @@ foreach( entry ${list} ) message( STATUS "Configuring examples in ${entry}" ) + string( REGEX REPLACE "${CMAKE_SOURCE_DIR}/*/examples/" "" DEMO_DIR "${entry}" ) + if( NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") # out-of-source - string( REGEX REPLACE "${CMAKE_SOURCE_DIR}/*/examples/" "" DEMO_DIR "${entry}" ) - make_directory(${CMAKE_BINARY_DIR}/demo/${DEMO_DIR}) + make_directory(${CMAKE_BINARY_DIR}/demo/${DEMO_DIR}) endif() set(ADD_SUBDIR TRUE)