Skip to content

Commit b99b06f

Browse files
committed
Merge #2965: [CMake] Add WSL2 support
e2c3f40 [CMake] Add WSL2 support (Fuzzbawls) Pull request description: Adds WSL2 detection support to CMake builds. WSL2 comes with WSLg by default, allowing users to run linux GUI applications (X11/Wayland) natively without needing a separate XWindow server. More Information about WSLg can be found at https://github.com/microsoft/wslg ACKs for top commit: e2c3f40 Duddino: utACK e2c3f40 Liquid369: ACK e2c3f40 Tree-SHA512: 8df4e2ebf9b0801bf19c8af532fd8398eb6653c5401aaa229442f2711d1210170eda9a670db54a3f7b3eb7d7f0e9e52cb2342ecc33b787ce4315408d8257fa3f
2 parents 1710df7 + e2c3f40 commit b99b06f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,17 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
6161
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
6262
set(ENV{target} "Linux")
6363
file(READ "/proc/version" _SYS_VERSION)
64-
string(REGEX MATCH "Microsoft" _SYSTEM_VERSION_PARSED "${_SYS_VERSION}")
64+
string(REGEX MATCH "[M|m]icrosoft" _SYSTEM_VERSION_PARSED "${_SYS_VERSION}")
6565
if(${_SYSTEM_VERSION_PARSED} MATCHES "Microsoft")
6666
message(STATUS "Compiling on WSL")
6767
set(ENV{DISPLAY} ":0")
6868
set(ENV{LIBGL_ALWAYS_INDIRECT} 1)
6969
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY /home/$ENV{USER}/pivx-run)
7070
message(WARNING "WSL Runtime support requires VcXsrv to be installed and running")
71+
elseif(${_SYSTEM_VERSION_PARSED} MATCHES "microsoft")
72+
message(STATUS "Compiling on WSL2")
73+
message(STATUS "WSL2 Runtime support requires a WSLg compatible system")
74+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY /home/$ENV{USER}/pivx-run)
7175
else()
7276
message(STATUS "Compiling on Linux")
7377
endif()

0 commit comments

Comments
 (0)