CMake buildsystem

This commit is contained in:
Gabriel Ferreira
2021-11-10 22:28:44 -03:00
committed by Tom Henderson
parent a4b86694f8
commit 9c876c7f5a
135 changed files with 8925 additions and 68 deletions

1
scratch/.gitignore vendored
View File

@@ -3,3 +3,4 @@
!.gitignore
!subdir/
!scratch-simulator.cc
!CMakeLists.txt

25
scratch/CMakeLists.txt Normal file
View File

@@ -0,0 +1,25 @@
file(GLOB_RECURSE scratches ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)
set(DONT_BUILD)
foreach(scratch_src ${scratches})
# Get source filename without path or extension
get_filename_component(scratch_name ${scratch_src} NAME)
string(REGEX REPLACE "\\.[^.]*$" "" scratch_name ${scratch_name})
# Get source absolute path and transform into relative path
get_filename_component(scratch_absolute_directory ${scratch_src} DIRECTORY)
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" scratch_directory ${scratch_absolute_directory})
# Build scratch if not listed as a DONT_BUILD
string(FIND "${DONT_BUILD}" "${scratch_name}" res)
if(res LESS 0)
add_executable(${scratch_name} "${scratch_src}")
if(${NS3_STATIC})
target_link_libraries(${scratch_name} ${LIB_AS_NEEDED_PRE_STATIC} ${lib-ns3-static})
else()
target_link_libraries(${scratch_name} "${ns3-libs}" "${ns3-contrib-libs}")
endif()
set_runtime_outputdirectory(${scratch_name} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/scratch/${scratch_directory}/)
endif()
endforeach()