Update CMakeLists.txt
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 406c6dd..6bfc078 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -37,14 +37,14 @@
       - name: build LLVM tools
         if: steps.llvm-build.outputs.cache-hit != 'true'
         run: |
-          cmake --build ${{ github.workspace }}/build/llvm-project --target FileCheck
-          cmake --build ${{ github.workspace }}/build/llvm-project --target yaml2obj
+          cmake --build ${{ github.workspace }}/build/llvm-project --config Release --target FileCheck
+          cmake --build ${{ github.workspace }}/build/llvm-project --config Release --target yaml2obj
 
       - uses: actions/checkout@v2
         with:
           path: bloaty
       - name: configure
-        run: cmake -B build/bloaty -D CMAKE_BUILD_TYPE=Debug -G "Visual Studio 16 2019" -A ${{ matrix.arch }} -S ${{ github.workspace }}/bloaty -D FILECHECK_EXECUTABLE=${{ github.workspace }}/build/llvm-project/bin/FileCheck.exe -D YAML2OBJ_EXECUTABLE=${{ github.workspace }}/build/llvm-project/bin/yaml2obj.exe -D LIT_EXECUTABLE=${{ github.workspace }}/llvm-project/utils/lit/lit.py
+        run: cmake -B build/bloaty -D CMAKE_BUILD_TYPE=Debug -G "Visual Studio 16 2019" -A ${{ matrix.arch }} -S ${{ github.workspace }}/bloaty -D FILECHECK_EXECUTABLE=${{ github.workspace }}/build/llvm-project/Release/bin/FileCheck.exe -D YAML2OBJ_EXECUTABLE=${{ github.workspace }}/build/llvm-project/Release/bin/yaml2obj.exe -D LIT_EXECUTABLE=${{ github.workspace }}/llvm-project/llvm/utils/lit/lit.py
       - name: build
         run: cmake --build build/bloaty --config Debug
       - name: test
@@ -90,7 +90,7 @@
         with:
           path: ${{ github.workspace }}/bloaty
       - name: configure
-        run: cmake -B build/bloaty -D CMAKE_BUILD_TYPE=Debug -D CMAKE_C_FLAGS=${{ matrix.cflags }} -D CMAKE_CXX_FLAGS=${{ matrix.cxxflags }} -S ${{ github.workspace }}/bloaty -D FILECHECK_EXECUTABLE=${{ github.workspace }}/build/llvm-project/bin/FileCheck -D YAML2OBJ_EXECUTABLE=${{ github.workspace }}/build/llvm-project/bin/yaml2obj -D LIT_EXECUTABLE=${{ github.workspace }}/llvm-project/utils/lit/lit.py
+        run: cmake -B build/bloaty -D CMAKE_BUILD_TYPE=Debug -D CMAKE_C_FLAGS=${{ matrix.cflags }} -D CMAKE_CXX_FLAGS=${{ matrix.cxxflags }} -S ${{ github.workspace }}/bloaty -D FILECHECK_EXECUTABLE=${{ github.workspace }}/build/llvm-project/bin/FileCheck -D YAML2OBJ_EXECUTABLE=${{ github.workspace }}/build/llvm-project/bin/yaml2obj -D LIT_EXECUTABLE=${{ github.workspace }}/llvm-project/llvm/utils/lit/lit.py
       - name: build
         run: cmake --build build/bloaty --config Debug
       - name: test
@@ -136,7 +136,7 @@
         with:
           path: ${{ github.workspace }}/bloaty
       - name: configure
-        run: cmake -B build/bloaty -D CMAKE_BUILD_TYPE=Debug -S ${{ github.workspace }}/bloaty -D FILECHECK_EXECUTABLE=${{ github.workspace }}/build/llvm-project/bin/FileCheck -D YAML2OBJ_EXECUTABLE=${{ github.workspace }}/build/llvm-project/bin/yaml2obj -D LIT_EXECUTABLE=${{ github.workspace }}/llvm-project/utils/lit/lit.py
+        run: cmake -B build/bloaty -D CMAKE_BUILD_TYPE=Debug -S ${{ github.workspace }}/bloaty -D FILECHECK_EXECUTABLE=${{ github.workspace }}/build/llvm-project/bin/FileCheck -D YAML2OBJ_EXECUTABLE=${{ github.workspace }}/build/llvm-project/bin/yaml2obj -D LIT_EXECUTABLE=${{ github.workspace }}/llvm-project/llvm/utils/lit/lit.py
         env:
           CC: ${{ matrix.CC }}
           CXX: ${{ matrix.CXX }}
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 55a17d8..4c91091 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -338,13 +338,17 @@
     find_program(LIT_EXECUTABLE NAMES lit lit.py)
     find_program(FILECHECK_EXECUTABLE FileCheck)
     find_program(YAML2OBJ_EXECUTABLE yaml2obj)
-    if(Python_FOUND AND LIT AND FILECHECK AND YAML2OBJ)
+    if(Python_FOUND AND LIT_EXECUTABLE AND FILECHECK_EXECUTABLE AND YAML2OBJ_EXECUTABLE)
       set(BLOATY_SRC_DIR ${PROJECT_SOURCE_DIR})
       set(BLOATY_OBJ_DIR ${PROJECT_BINARY_DIR})
       configure_file(tests/lit.site.cfg.in tests/lit.site.cfg @ONLY)
 
       add_custom_target(check-bloaty
-        COMMAND ${Python_EXECUTABLE} ${LIT_EXECUTABLE} -sv ${PROJECT_BINARY_DIR}/tests
+        COMMAND ${Python_EXECUTABLE} ${LIT_EXECUTABLE} -sv ${PROJECT_BINARY_DIR}/tests --param bloaty=$<TARGET_FILE:bloaty>
+        DEPENDS
+          bloaty
+          ${CMAKE_CURRENT_SOURCE_DIR}/tests/lit.cfg
+          ${CMAKE_CURRENT_BINARY_DIR}/tests/lit.site.cfg
         COMMENT "Running bloaty tests..."
         USES_TERMINAL)
     endif()
diff --git a/tests/lit.cfg b/tests/lit.cfg
index 7d0e68e..475759a 100644
--- a/tests/lit.cfg
+++ b/tests/lit.cfg
@@ -29,6 +29,13 @@
   lit_config.fatal("missing 'bloaty_obj_root' key in the site specific config")
 bloaty_obj_root = os.path.normpath(bloaty_obj_root)
 
+if not lit_config.params.get('bloaty', None):
+  lit_config.fatal("missing parameter 'bloaty'")
+
+lit_config.note('Using bloaty: {}'.format(lit_config.params['bloaty']))
+lit_config.note('Using FileCheck: {}'.format(config.filecheck_path))
+lit_config.note('Using yaml2obj: {}'.format(config.yaml2obj_path))
+
 use_lit_shell = os.environ.get('LIT_USE_INTERNAL_SHELL', kIsWindows)
 if not use_lit_shell:
   config.available_features.add('shell')
@@ -43,4 +50,4 @@
 
 config.substitutions.append(('%FileCheck', config.filecheck_path))
 config.substitutions.append(('%yaml2obj', config.yaml2obj_path))
-config.substitutions.append(('%bloaty', make_path(config.bloaty_obj_root, 'bloaty')))
+config.substitutions.append(('%bloaty', lit_config.params['bloaty']))