diff --git a/src/fpm_environment.f90 b/src/fpm_environment.f90 index 714af6a6ad..b797d74997 100644 --- a/src/fpm_environment.f90 +++ b/src/fpm_environment.f90 @@ -51,15 +51,6 @@ integer function get_os_type() result(r) first_run = .false. r = OS_UNKNOWN - ! Check environment variable `OS`. - call get_environment_variable('OS', val, length, rc) - - if (rc == 0 .and. length > 0 .and. index(val, 'Windows_NT') > 0) then - r = OS_WINDOWS - ret = r - return - end if - ! Check environment variable `OSTYPE`. call get_environment_variable('OSTYPE', val, length, rc) @@ -114,6 +105,15 @@ integer function get_os_type() result(r) end if end if + ! Check environment variable `OS`. + call get_environment_variable('OS', val, length, rc) + + if (rc == 0 .and. length > 0 .and. index(val, 'Windows_NT') > 0) then + r = OS_WINDOWS + ret = r + return + end if + ! Linux inquire (file='/etc/os-release', exist=file_exists)