archive_options.cmake 1.4 KB

12345678910111213141516171819202122232425262728
  1. # Copyright 2019 Google
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. if(APPLE)
  15. # When building on Apple platforms, ranlib complains about "file has no
  16. # symbols". Unfortunately, most of our dependencies implement their
  17. # cross-platform build with preprocessor symbols so translation units that
  18. # don't target the current platform end up empty (and trigger this warning).
  19. #
  20. # Note this can't be set in compiler_setup.cmake because that is included
  21. # late so as not to affect our dependencies. These variables have to be set
  22. # early so that they do affect our dependencies.
  23. set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
  24. set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
  25. set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
  26. set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
  27. endif()