Port to 3.1 - Fix out of range access in GetRecycleMemoryInfo (#27959)
[platform/upstream/coreclr.git] / pgosupport.cmake
index bc331be..dec0500 100644 (file)
@@ -28,7 +28,9 @@ function(add_pgo TargetName)
         endif(WIN32)
     elseif(CLR_CMAKE_PGO_OPTIMIZE)
         # If we don't have profile data availble, gracefully fall back to a non-PGO opt build
-        if(EXISTS ${ProfilePath})
+        if(NOT EXISTS ${ProfilePath})
+            message("PGO data file NOT found: ${ProfilePath}")
+        else(NOT EXISTS ${ProfilePath})
             if(WIN32)
                 set_property(TARGET ${TargetName} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE        " /LTCG /USEPROFILE:PGD=${ProfilePath}")
                 set_property(TARGET ${TargetName} APPEND_STRING PROPERTY LINK_FLAGS_RELWITHDEBINFO " /LTCG /USEPROFILE:PGD=${ProfilePath}")
@@ -46,6 +48,6 @@ function(add_pgo TargetName)
                     endif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6)
                 endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELEASE OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELWITHDEBINFO)
             endif(WIN32)
-        endif(EXISTS ${ProfilePath})
+        endif(NOT EXISTS ${ProfilePath})
     endif(CLR_CMAKE_PGO_INSTRUMENT)
 endfunction(add_pgo)