FindDiaSDK.cmake 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Find the DIA SDK path.
  2. get_filename_component(VS_PATH32 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]" ABSOLUTE CACHE)
  3. get_filename_component(VS_PATH64 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\VisualStudio\\14.0;InstallDir]" ABSOLUTE CACHE)
  4. # VS_PATH32 will be something like C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE
  5. # Also look for in vs15 install.
  6. # TODO: update this to be a non-hardcoded path. Registry keys were removed
  7. # in vs15 in favor of COM server dlls.
  8. # https://blogs.msdn.microsoft.com/heaths/2016/09/15/changes-to-visual-studio-15-setup/
  9. get_filename_component(VS15_C_PATH32 "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE" ABSOLUTE CACHE)
  10. get_filename_component(VS15_P_PATH32 "C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/Common7/IDE" ABSOLUTE CACHE)
  11. get_filename_component(VS15_E_PATH32 "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE" ABSOLUTE CACHE)
  12. # Find the TAEF path, it will typically look something like this.
  13. # C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\DIA SDK\include
  14. # C:\Program Files (x86)\Microsoft Visual Studio 14.0\DIA SDK\include\dia2.h
  15. find_path(DIASDK_INCLUDE_DIR # Set variable DIASDK_INCLUDE_DIR
  16. dia2.h # Find a path with dia2.h
  17. HINTS "${VS15_C_PATH32}/../../DIA SDK/include"
  18. HINTS "${VS15_P_PATH32}/../../DIA SDK/include"
  19. HINTS "${VS15_E_PATH32}/../../DIA SDK/include"
  20. HINTS "${VS_PATH64}/../../DIA SDK/include"
  21. HINTS "${VS_PATH32}/../../DIA SDK/include"
  22. DOC "path to DIA SDK header files"
  23. HINTS
  24. )
  25. if (CMAKE_GENERATOR MATCHES "Visual Studio.*Win64" )
  26. find_library(DIASDK_GUIDS_LIBRARY NAMES diaguids.lib
  27. HINTS ${DIASDK_INCLUDE_DIR}/../lib/amd64 )
  28. elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM" )
  29. find_library(DIASDK_GUIDS_LIBRARY NAMES diaguids.lib
  30. HINTS ${DIASDK_INCLUDE_DIR}/../lib/arm )
  31. else (CMAKE_GENERATOR MATCHES "Visual Studio.*Win64" )
  32. find_library(DIASDK_GUIDS_LIBRARY NAMES diaguids.lib
  33. HINTS ${DIASDK_INCLUDE_DIR}/../lib )
  34. endif (CMAKE_GENERATOR MATCHES "Visual Studio.*Win64" )
  35. set(DIASDK_LIBRARIES ${DIASDK_GUIDS_LIBRARY})
  36. set(DIASDK_INCLUDE_DIRS ${DIASDK_INCLUDE_DIR})
  37. include(FindPackageHandleStandardArgs)
  38. # handle the QUIETLY and REQUIRED arguments and set DIASDK_FOUND to TRUE
  39. # if all listed variables are TRUE
  40. find_package_handle_standard_args(DIASDK DEFAULT_MSG
  41. DIASDK_LIBRARIES DIASDK_INCLUDE_DIR)
  42. mark_as_advanced(DIASDK_INCLUDE_DIRS DIASDK_LIBRARIES)