GNU.cmake 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #=============================================================================
  2. # Copyright 2002-2009 Kitware, Inc.
  3. #
  4. # Distributed under the OSI-approved BSD License (the "License");
  5. # see accompanying file Copyright.txt for details.
  6. #
  7. # This software is distributed WITHOUT ANY WARRANTY; without even the
  8. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. # See the License for more information.
  10. #=============================================================================
  11. # (To distribute this file outside of CMake, substitute the full
  12. # License text for the above reference.)
  13. # This module is shared by multiple languages; use include blocker.
  14. if(__COMPILER_GNU)
  15. return()
  16. endif()
  17. set(__COMPILER_GNU 1)
  18. macro(__compiler_gnu lang)
  19. # Feature flags.
  20. set(CMAKE_${lang}_VERBOSE_FLAG "-v")
  21. set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
  22. set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
  23. # Initial configuration flags.
  24. set(CMAKE_${lang}_FLAGS_INIT "")
  25. set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g")
  26. set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
  27. set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
  28. set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
  29. set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
  30. set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
  31. if(NOT APPLE)
  32. set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
  33. endif(NOT APPLE)
  34. endmacro()