Add a AUTHOR_WARNING if the source file does not exist.

This commit is contained in:
Laurent Rineau 2012-11-30 10:34:29 +01:00
parent acb7dcebbc
commit e33d05f919
1 changed files with 37 additions and 35 deletions

View File

@ -1,35 +1,37 @@
function(create_single_source_cgal_program firstfile ) function(create_single_source_cgal_program firstfile )
if(NOT IS_ABSOLUTE "${firstfile}") if(NOT IS_ABSOLUTE "${firstfile}")
set(firstfile "${CMAKE_CURRENT_SOURCE_DIR}/${firstfile}") set(firstfile "${CMAKE_CURRENT_SOURCE_DIR}/${firstfile}")
endif() endif()
if(EXISTS "${firstfile}") get_filename_component(exe_name ${firstfile} NAME_WE)
set( all "${firstfile}" ) if(EXISTS "${firstfile}")
# remaining files set( all "${firstfile}" )
foreach( i ${ARGN} )
set( all ${all} ${CMAKE_CURRENT_SOURCE_DIR}/${i} ) # remaining files
endforeach() foreach( i ${ARGN} )
set( all ${all} ${CMAKE_CURRENT_SOURCE_DIR}/${i} )
endforeach()
get_filename_component(exe_name ${firstfile} NAME_WE)
add_executable(${exe_name} ${all})
add_executable(${exe_name} ${all})
add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${exe_name} )
add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${exe_name} )
# Link the executable to CGAL and third-party libraries
if ( CGAL_AUTO_LINK_ENABLED ) # Link the executable to CGAL and third-party libraries
if ( CGAL_AUTO_LINK_ENABLED )
target_link_libraries(${exe_name} ${CGAL_3RD_PARTY_LIBRARIES} )
target_link_libraries(${exe_name} ${CGAL_3RD_PARTY_LIBRARIES} )
else()
else()
target_link_libraries(${exe_name} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
target_link_libraries(${exe_name} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
endif()
endif()
endif() else()
message(AUTHOR_WARNING "The executable ${exe_name} will not be created because the source file ${firstfile} does not exist.")
endfunction() endif()
endfunction()