@@ -370,9 +370,9 @@ function _add_project(cmakelists, outputdir)
370370 end
371371 -- Define a language-independant global compiler_id variable
372372 if (languages and # languages > 0 ) then
373- cmakelists :print (" set(XMAKE_GLOBAL_COMPILER_ID ${CMAKE_%s_COMPILER_ID})" , _get_project_languages ()[1 ])
373+ cmakelists :print (" set(CURRENT_COMPILER_ID ${CMAKE_%s_COMPILER_ID})" , _get_project_languages ()[1 ])
374374 else
375- cmakelists :print (" set(XMAKE_GLOBAL_COMPILER_ID ${CMAKE_C_COMPILER_ID})" ) -- C should be defined by default if not specified
375+ cmakelists :print (" set(CURRENT_COMPILER_ID ${CMAKE_C_COMPILER_ID})" ) -- C should be defined by default if not specified
376376 end
377377 cmakelists :print (" " )
378378end
@@ -790,7 +790,7 @@ function _add_target_compile_options(cmakelists, target, outputdir)
790790 for _ , toolname in toolnames :keys () do
791791 local name = compilernames [toolname ]
792792 if name then
793- cmakelists :print (" if(XMAKE_GLOBAL_COMPILER_ID STREQUAL \" %s\" )" , name )
793+ cmakelists :print (" if(CURRENT_COMPILER_ID STREQUAL \" %s\" )" , name )
794794 _add_target_compile_options_for_compiler (toolname )
795795 cmakelists :print (" endif()" )
796796 end
@@ -817,17 +817,17 @@ function _add_target_values(cmakelists, target, name)
817817 if name :endswith (" s" ) then
818818 name = name :sub (1 , # name - 1 )
819819 end
820- cmakelists :print (" if(XMAKE_GLOBAL_COMPILER_ID STREQUAL \" MSVC\" )" )
820+ cmakelists :print (" if(CURRENT_COMPILER_ID STREQUAL \" MSVC\" )" )
821821 local flags_cl = _map_compflags (" cl" , " c" , name , values )
822822 for _ , flag in ipairs (flags_cl ) do
823823 cmakelists :print (" target_compile_options(%s PRIVATE %s)" , target :name (), flag )
824824 end
825- cmakelists :print (" elseif(XMAKE_GLOBAL_COMPILER_ID STREQUAL \" Clang\" )" )
825+ cmakelists :print (" elseif(CURRENT_COMPILER_ID STREQUAL \" Clang\" )" )
826826 local flags_clang = _map_compflags (" clang" , " c" , name , values )
827827 for _ , flag in ipairs (flags_clang ) do
828828 cmakelists :print (" target_compile_options(%s PRIVATE %s)" , target :name (), flag )
829829 end
830- cmakelists :print (" elseif(XMAKE_GLOBAL_COMPILER_ID STREQUAL \" GNU\" )" )
830+ cmakelists :print (" elseif(CURRENT_COMPILER_ID STREQUAL \" GNU\" )" )
831831 local flags_gcc = _map_compflags (" gcc" , " c" , name , values )
832832 for _ , flag in ipairs (flags_gcc ) do
833833 cmakelists :print (" target_compile_options(%s PRIVATE %s)" , target :name (), flag )
@@ -894,7 +894,7 @@ function _add_target_languages(cmakelists, target)
894894 if flag :endswith (' ++' ) then
895895 cmakelists :print (' foreach(standard 26 23 20 17 14 11 98)' )
896896 cmakelists :print (' include(CheckCXXCompilerFlag)' )
897- cmakelists :print (' if(XMAKE_GLOBAL_COMPILER_ID STREQUAL \" MSVC\" )' )
897+ cmakelists :print (' if(CURRENT_COMPILER_ID STREQUAL \" MSVC\" )' )
898898 cmakelists :print (' check_cxx_compiler_flag("/std:%s${standard}" %s_support_%s_standard_${standard})' , flag , target :name (), flag )
899899 cmakelists :print (' else()' )
900900 cmakelists :print (' check_cxx_compiler_flag("-std=%s${standard}" %s_support_%s_standard_${standard})' , flag , target :name (), flag )
@@ -907,7 +907,7 @@ function _add_target_languages(cmakelists, target)
907907 else
908908 cmakelists :print (' foreach(standard 23 17 11 99 90)' )
909909 cmakelists :print (' include(CheckCCompilerFlag)' )
910- cmakelists :print (' if(XMAKE_GLOBAL_COMPILER_ID STREQUAL \" MSVC\" )' )
910+ cmakelists :print (' if(CURRENT_COMPILER_ID STREQUAL \" MSVC\" )' )
911911 cmakelists :print (' check_c_compiler_flag("/std:%s${standard}" %s_support_%s_standard_${standard})' , flag , target :name (), flag )
912912 cmakelists :print (' else()' )
913913 cmakelists :print (' check_c_compiler_flag("-std=%s${standard}" %s_support_%s_standard_${standard})' , flag , target :name (), flag )
@@ -947,7 +947,7 @@ function _add_target_optimization(cmakelists, target)
947947 }
948948 local optimization = target :get (" optimize" )
949949 if optimization then
950- cmakelists :print (" if(XMAKE_GLOBAL_COMPILER_ID STREQUAL \" MSVC\" )" )
950+ cmakelists :print (" if(CURRENT_COMPILER_ID STREQUAL \" MSVC\" )" )
951951 cmakelists :print (" target_compile_options(%s PRIVATE %s)" , target :name (), flags_msvc [optimization ])
952952 cmakelists :print (" else()" )
953953 cmakelists :print (" target_compile_options(%s PRIVATE %s)" , target :name (), flags_gcc [optimization ])
@@ -975,7 +975,7 @@ function _add_target_symbols(cmakelists, target)
975975 if levels :has (" hidden" ) then
976976 table.insert (flags_gcc , " -fvisibility=hidden" )
977977 end
978- cmakelists :print (" if(XMAKE_GLOBAL_COMPILER_ID STREQUAL \" MSVC\" )" )
978+ cmakelists :print (" if(CURRENT_COMPILER_ID STREQUAL \" MSVC\" )" )
979979 if # flags_msvc > 0 then
980980 cmakelists :print (" target_compile_options(%s PRIVATE %s)" , target :name (), table.concat (flags_msvc , " " ))
981981 end
@@ -996,7 +996,7 @@ function _add_target_runtimes(cmakelists, target)
996996 local cmake_minver = _get_cmake_minver ()
997997 if cmake_minver :ge (" 3.15.0" ) then
998998 local runtimes = target :get (" runtimes" )
999- cmakelists :print (" if(XMAKE_GLOBAL_COMPILER_ID STREQUAL \" MSVC\" )" )
999+ cmakelists :print (" if(CURRENT_COMPILER_ID STREQUAL \" MSVC\" )" )
10001000 if runtimes then
10011001 if runtimes == " MT" then
10021002 runtimes = " MultiThreaded"
@@ -1111,7 +1111,7 @@ function _add_target_link_directories(cmakelists, target, outputdir)
11111111 end
11121112 cmakelists :print (" )" )
11131113 else
1114- cmakelists :print (" if(XMAKE_GLOBAL_COMPILER_ID STREQUAL \" MSVC\" )" )
1114+ cmakelists :print (" if(CURRENT_COMPILER_ID STREQUAL \" MSVC\" )" )
11151115 cmakelists :print (" target_link_libraries(%s PRIVATE" , target :name ())
11161116 for _ , linkdir in ipairs (linkdirs ) do
11171117 cmakelists :print (" -libpath:" .. _get_relative_unix_path (linkdir , outputdir ))
@@ -1178,7 +1178,7 @@ function _add_target_link_options(cmakelists, target, outputdir)
11781178 for _ , toolname in toolnames :keys () do
11791179 local name = linkernames [toolname ]
11801180 if name then
1181- cmakelists :print (" if(XMAKE_GLOBAL_COMPILER_ID STREQUAL \" %s\" )" , name )
1181+ cmakelists :print (" if(CURRENT_COMPILER_ID STREQUAL \" %s\" )" , name )
11821182 _add_target_link_options_for_linker (toolname )
11831183 cmakelists :print (" endif()" )
11841184 end
0 commit comments