Create userdata without user values in Lua 5.4
[liba.git] / cmake / Languages.cmake
blob81d97133aead069d0709161dc653cc6e4b89fe34
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)
5   if(has_cxx)
6     option(LIBA_CXX "Enable/Disable C++" 1)
7   else()
8     option(LIBA_CXX "Enable/Disable C++" 0)
9   endif()
10   set(has_cxx)
11 endif()
12 list(FIND LANGUAGES CXX index)
13 if(${index} EQUAL -1 AND LIBA_CXX)
14   list(INSERT LANGUAGES 0 CXX)
15 endif()
16 list(FIND LANGUAGES C index)
17 if(${index} EQUAL -1)
18   list(INSERT LANGUAGES 0 C)
19 endif()
20 # default C standard
21 if(NOT CMAKE_C_STANDARD)
22   set(CMAKE_C_STANDARD 11)
23 endif()
24 if(NOT CMAKE_C_EXTENSIONS)
25   set(CMAKE_C_EXTENSIONS 0)
26 endif()
27 if(NOT CMAKE_C_STANDARD_REQUIRED)
28   set(CMAKE_C_STANDARD_REQUIRED 0)
29 endif()
30 # default C++ standard
31 if(NOT CMAKE_CXX_STANDARD)
32   set(CMAKE_CXX_STANDARD 11)
33 endif()
34 if(NOT CMAKE_CXX_EXTENSIONS)
35   set(CMAKE_CXX_EXTENSIONS 0)
36 endif()
37 if(NOT CMAKE_CXX_STANDARD_REQUIRED)
38   set(CMAKE_CXX_STANDARD_REQUIRED 0)
39 endif()
40 if(CMAKE_C_COMPILER_ID MATCHES "TinyCC")
41   string(FIND CMAKE_C_FLAGS "-std=c${CMAKE_C_STANDARD}" index)
42   if(${index} EQUAL -1)
43     string(STRIP "${CMAKE_C_FLAGS} -std=c${CMAKE_C_STANDARD}" CMAKE_C_FLAGS)
44   endif()
45 endif()
46 set(index)