linux.cmake 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #[=======================================================================[.rst:
  2. Linux
  3. -----
  4. This file contains functions for options and configuration for targeting the
  5. Linux platform
  6. ]=======================================================================]
  7. #[=============================[ Linux Options ]=============================]
  8. function(linux_options)
  9. #[[ Options from SCons
  10. use_llvm : Use the LLVM compiler
  11. Not implemented as compiler selection is managed by CMake. Look to
  12. doc/cmake.rst for examples.
  13. ]]
  14. option(GODOTCPP_USE_STATIC_CPP "Link libgcc and libstdc++ statically for better portability" ON)
  15. endfunction()
  16. #[===========================[ Target Generation ]===========================]
  17. function(linux_generate)
  18. set(STATIC_CPP "$<BOOL:${GODOTCPP_USE_STATIC_CPP}>")
  19. target_compile_definitions(godot-cpp PUBLIC LINUX_ENABLED UNIX_ENABLED)
  20. # gersemi: off
  21. target_link_options(
  22. godot-cpp
  23. PUBLIC
  24. $<${STATIC_CPP}:
  25. -static-libgcc
  26. -static-libstdc++
  27. >
  28. )
  29. # gersemi: on
  30. common_compiler_flags()
  31. endfunction()