SHARE
TWEET

Untitled

a guest Aug 25th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cmake_minimum_required(VERSION 3.9)
  2.  
  3. set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE)
  4. set(CMAKE_BUILD_TYPE Debug CACHE STRING "")
  5.  
  6. set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE)
  7. set(CMAKE_SKIP_INSTALL_RPATH TRUE)
  8. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
  9. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
  10. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
  11.  
  12. project(projectname)
  13.  
  14. set(CMAKE_CXX_STANDARD 20)
  15.  
  16. if (MSVC)
  17. set(CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS -utf-8 -permissive- -EHs-c- -D_HAS_EXCEPTIONS=0 -GR- -GS- -Zc:inline -arch:AVX2 -MP -Z7")
  18. string(APPEND CMAKE_CXX_FLAGS "-W4 -WX -wd4100 -wd4996 -wd4505 -w44062")
  19. set(CMAKE_CXX_FLAGS_DEBUG "-O1 -Zo -JMC -MDd") # /Oy- ?
  20. set(CMAKE_CXX_FLAGS_RELEASE "/MD /O2 /Ob3 /UNDEBUG /GL -fp:fast")
  21. link_libraries(optimized -DEBUG -OPT:REF -OPT:ICF -LTCG:INCREMENTAL)
  22. elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
  23. set(CMAKE_CXX_FLAGS "-march=native -fno-exceptions -fno-rtti -fvisibility=hidden")
  24. string(APPEND CMAKE_CXX_FLAGS "-Werror -Wall -Wextra -Wno-unused-parameter -Wconversion -Wcast-qual -Wsign-conversion -Wfloat-conversion -Wmultiple-inheritance -Werror=virtual-inheritance -Wshadow=local")
  25. set(CMAKE_CXX_FLAGS_RELEASE "-O3 -UNDEBUG -ffast-math")
  26. add_link_options(-Wl,--as-needed,--no-undefined,--gc-sections -fsanitize=leak)
  27. endif()
  28.  
  29. file(GLOB SRCS CONFIGURE_DEPENDS *.cpp *.h)
  30. add_library(projectname ${SRCS})
  31. #target_include_directories(projectname SYSTEM PRIVATE ${CMAKE_BINARY_DIR}/include)
  32. #target_link_directories(projectname PRIVATE ${CMAKE_BINARY_DIR}/lib)
  33. #target_link_libraries(projectname debug libd optimized lib)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top