fix to build demos and example properly, and even out-of-source now

This commit is contained in:
Eric Berberich 2011-04-21 08:47:46 +00:00
parent 9bcf77ab04
commit 4d457ba1ad
2 changed files with 21 additions and 5 deletions

View File

@ -17,9 +17,17 @@ foreach( entry ${list} )
if ( IS_DIRECTORY ${entry} )
if ( EXISTS ${entry}/CMakeLists.txt )
message( STATUS "Configuring ${entry} demo" )
add_subdirectory( ${entry} )
endif()
message( STATUS "Configuring demo in ${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})
endif()
add_subdirectory( ${entry} ${CMAKE_BINARY_DIR}/demo/${DEMO_DIR} )
Endif()
endif()

View File

@ -17,8 +17,16 @@ foreach( entry ${list} )
if ( IS_DIRECTORY ${entry} )
if ( EXISTS ${entry}/CMakeLists.txt )
message( STATUS "Configuring ${entry} example" )
add_subdirectory( ${entry} )
message( STATUS "Configuring examples in ${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})
endif()
add_subdirectory( ${entry} ${CMAKE_BINARY_DIR}/examples/${DEMO_DIR} )
endif()
endif()