Skip to content

Commit 3adf82c

Browse files
committed
Fixed the following warning message if WIX environment variable is not defined:
1> CMake Error at cmake/FindWIX.cmake:30 (string): 1> string sub-command REPLACE requires at least four arguments.
1 parent e659555 commit 3adf82c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

cmake/FindWIX.cmake

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ if (WIN32)
2525
file(GLOB _WIX_DIRECTORIES_X64 "C:/Program Files/WiX Toolset*")
2626
file(GLOB _WIX_DIRECTORIES_X86 "C:/Program Files (x86)/WiX Toolset*")
2727

28-
# The environment variable WIX can end with a '\' character. This backslash character is escaping the next character which is the list separator ';'.
29-
set(_WIX_ENV_PATH "$ENV{WIX}")
30-
string(REPLACE "\\" "/" _WIX_ENV_PATH ${_WIX_ENV_PATH})
28+
# Read WIX environment variable if defined to an existing path
29+
set(_WIX_ENV_PATH "") # Set to an empty value by default
30+
if(EXISTS "$ENV{WIX}")
31+
# The environment variable WIX can end with a '\' character.
32+
# This backslash character is escaping the next character which is the list separator ';'.
33+
set(_WIX_ENV_PATH "$ENV{WIX}")
34+
string(REPLACE "\\" "/" _WIX_ENV_PATH ${_WIX_ENV_PATH})
35+
endif(EXISTS "$ENV{WIX}")
3136

3237
# Define know directory locations where it could be installed.
3338
set(_WIX_ROOT_PATHS

0 commit comments

Comments
 (0)