Skip to content

Instantly share code, notes, and snippets.

@scivision
Last active March 20, 2023 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scivision/e908a347a505dbe3db78163a432884d0 to your computer and use it in GitHub Desktop.
Save scivision/e908a347a505dbe3db78163a432884d0 to your computer and use it in GitHub Desktop.
append to PATH env var on Windows for CTest
# works for Unix, Windows, etc.
cmake_minimum_required(VERSION 3.22)
project(WindowsPath LANGUAGES C)
find_library(ZLIB REQUIRED)
add_executable(hello hello.c)
target_link_libraries(hello PRIVATE ZLIB::ZLIB)
add_test(NAME unit_hello COMMAND hello)
if(WIN32)
set_property(TEST unit_hello PROPERTY ENVIRONMENT_MODIFICATION "PATH=path_list_append:/path/to/dlls")
endif()
#include "zlib.h"
int main(void) { return 0; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment