cgal/Installation/cmake/modules/CGAL_CreateSingleSourceCGAL...

36 lines
874 B
CMake

function(create_single_source_cgal_program firstfile )
if(NOT IS_ABSOLUTE "${firstfile}")
set(file "${CMAKE_CURRENT_SOURCE_DIR}/${firstfile}")
endif()
if(EXISTS "${firstfile}")
set( all "${firstfile}" )
# remaining files
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_to_cached_list( CGAL_EXECUTABLE_TARGETS ${exe_name} )
# Link the executable to CGAL and third-party libraries
if ( CGAL_AUTO_LINK_ENABLED )
target_link_libraries(${exe_name} ${CGAL_3RD_PARTY_LIBRARIES} )
else()
target_link_libraries(${exe_name} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
endif()
endif()
endfunction()