Fixed #6442: Use cmake to provide source directory for test pem
(cherry picked from commit 70881d3957
)
This commit is contained in:
parent
031eb5f9aa
commit
048bd8e656
@ -17,6 +17,10 @@ include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
|
||||
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} TEST_PATH)
|
||||
string(REGEX REPLACE "\\\\" "\\\\\\\\" TEST_PATH ${TEST_PATH})
|
||||
|
||||
add_definitions(-DTEST_SOURCE_DIR="${TEST_PATH}")
|
||||
target_link_libraries(${MODULE_NAME} freerdp winpr ${OPENSSL_LIBRARIES})
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
||||
|
@ -33,6 +33,15 @@ static char* certificate_path(void)
|
||||
static const char dirsep = '/';
|
||||
#endif
|
||||
static const char filename[] = "Test_x509_cert_info.pem";
|
||||
#ifdef TEST_SOURCE_DIR
|
||||
const char* file = TEST_SOURCE_DIR;
|
||||
const size_t flen = sizeof(filename) + sizeof(dirsep) + strlen(file) + sizeof(char);
|
||||
char* result = calloc(1, flen);
|
||||
if (!result)
|
||||
return NULL;
|
||||
_snprintf(result, flen - 1, "%s%c%s", file, dirsep, filename);
|
||||
return result;
|
||||
#else
|
||||
const char* file = __FILE__;
|
||||
const char* last_dirsep = strrchr(file, dirsep);
|
||||
|
||||
@ -52,6 +61,7 @@ static char* certificate_path(void)
|
||||
/* No dirsep => relative path in same directory */
|
||||
return _strdup(filename);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static const certificate_test_t certificate_tests[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user