Windows: bunch of build fixes with CMake (#1585)

This commit is contained in:
Alexander Epaneshnikov
2022-12-09 01:25:01 +03:00
committed by GitHub
4 changed files with 18 additions and 1 deletions
+3
View File
@@ -10,6 +10,9 @@ set_target_properties(espeak-ng-bin PROPERTIES OUTPUT_NAME espeak-ng)
target_link_libraries(
espeak-ng-bin PRIVATE espeak-ng espeak-ng-config
)
if (MINGW)
target_link_options(espeak-ng-bin PRIVATE "-static-libstdc++" "-static")
endif()
if (MSVC)
target_sources(espeak-ng-bin PRIVATE compat/getopt.c)
endif()
+10
View File
@@ -102,4 +102,14 @@ if (NOT MSVC)
endif()
target_link_libraries(espeak-ng PUBLIC espeak-include)
if ((MINGW OR WIN32 OR MSVC) AND BUILD_SHARED_LIBS)
set_target_properties(espeak-ng PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ..
)
endif()
if (MINGW)
target_link_options(espeak-ng PRIVATE "-static-libstdc++" "-static")
endif()
install(TARGETS espeak-ng LIBRARY)
+4
View File
@@ -10,6 +10,7 @@ macro(compiled_test _test_name)
target_link_libraries(test_${_test_name} PRIVATE
$<TARGET_PROPERTY:espeak-ng,LINK_LIBRARIES>
)
target_compile_definitions(test_${_test_name} PRIVATE LIBESPEAK_NG_EXPORT=1)
target_include_directories(
test_${_test_name} PRIVATE
$<TARGET_PROPERTY:espeak-ng,SOURCE_DIR>
@@ -17,6 +18,9 @@ macro(compiled_test _test_name)
$<TARGET_PROPERTY:espeak-ng,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:espeak-ng-config,INTERFACE_INCLUDE_DIRECTORIES>
)
if (MINGW)
target_link_options(test_${_test_name} PUBLIC "-static" "-static-libstdc++")
endif()
add_dependencies(test_${_test_name} data)
add_test(
NAME ${_test_name}
+1 -1
View File
@@ -630,7 +630,7 @@ main(int argc, char **argv)
(void)argc; // unused parameter
char *progdir = strdup(argv[0]);
char *dir = strrchr(progdir, '/');
char *dir = strrchr(progdir, PATHSEP);
if (dir != NULL) *dir = 0;
test_espeak_terminate_without_initialize();