1 set(CMAKE_EXPORT_COMPILE_COMMANDS 1 CACHE BOOL "Enable/Disable output of compile commands during generation.")
2 mark_as_advanced(CMAKE_EXPORT_COMPILE_COMMANDS)
3 if(NOT DEFINED CACHE{LIBA_CXX})
4 file(GLOB_RECURSE has_cxx *.cc *.hh *.cpp *.hpp *.cxx *.hxx *.ixx *.ipp *.txx *.tpp *.mpp *.cppm)
6 option(LIBA_CXX "Enable/Disable C++" 1)
8 option(LIBA_CXX "Enable/Disable C++" 0)
12 list(FIND LANGUAGES CXX index)
13 if(${index} EQUAL -1 AND LIBA_CXX)
14 list(INSERT LANGUAGES 0 CXX)
16 list(FIND LANGUAGES C index)
18 list(INSERT LANGUAGES 0 C)
21 if(NOT CMAKE_C_STANDARD)
22 set(CMAKE_C_STANDARD 11)
24 if(NOT CMAKE_C_EXTENSIONS)
25 set(CMAKE_C_EXTENSIONS 0)
27 if(NOT CMAKE_C_STANDARD_REQUIRED)
28 set(CMAKE_C_STANDARD_REQUIRED 0)
30 # default C++ standard
31 if(NOT CMAKE_CXX_STANDARD)
32 set(CMAKE_CXX_STANDARD 11)
34 if(NOT CMAKE_CXX_EXTENSIONS)
35 set(CMAKE_CXX_EXTENSIONS 0)
37 if(NOT CMAKE_CXX_STANDARD_REQUIRED)
38 set(CMAKE_CXX_STANDARD_REQUIRED 0)
40 if(CMAKE_C_COMPILER_ID MATCHES "TinyCC")
41 string(FIND CMAKE_C_FLAGS "-std=c${CMAKE_C_STANDARD}" index)
43 string(STRIP "${CMAKE_C_FLAGS} -std=c${CMAKE_C_STANDARD}" CMAKE_C_FLAGS)