diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 866c1325a1ddca46260e2f89f15bae8390789357..54b3f3657f33ecfab1cce1851d5a6306938b71a8 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -590,7 +590,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
     std::vector<std::string> compileCommands;
     if (lang == "CUDA") {
       std::string cmdVar;
-      if (this->GeneratorTarget->GetProperty("CUDA_SEPARABLE_COMPILATION")) {
+      if (this->GeneratorTarget->GetPropertyAsBool(
+            "CUDA_SEPARABLE_COMPILATION")) {
         cmdVar = std::string("CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION");
       } else {
         cmdVar = std::string("CMAKE_CUDA_COMPILE_WHOLE_COMPILATION");
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 0b33b193f6fb4c75a98aa8870b416211898967aa..f09641649ec782f2a3cf862e323289e29c290fdd 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -580,7 +580,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
   std::vector<std::string> compileCmds;
   if (lang == "CUDA") {
     std::string cmdVar;
-    if (this->GeneratorTarget->GetProperty("CUDA_SEPARABLE_COMPILATION")) {
+    if (this->GeneratorTarget->GetPropertyAsBool(
+          "CUDA_SEPARABLE_COMPILATION")) {
       cmdVar = std::string("CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION");
     } else {
       cmdVar = std::string("CMAKE_CUDA_COMPILE_WHOLE_COMPILATION");