cmake: Fix empty -D due to empty strings (closes #5522)
parent
3b3f53ab55
commit
845f0e1133
4 changed files with 52 additions and 17 deletions
@ -0,0 +1,13 @@ |
||||
find_package(ZLIB) |
||||
|
||||
if(ZLIB_FOUND OR ZLIB_Found) |
||||
set(ImportedTarget_FOUND ON) |
||||
add_library(mesonTestLibDefs UNKNOWN IMPORTED) |
||||
set_property(TARGET mesonTestLibDefs PROPERTY IMPORTED_LOCATION ${ZLIB_LIBRARY}) |
||||
set_property(TARGET mesonTestLibDefs PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIR}) |
||||
set_property(TARGET mesonTestLibDefs APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS REQUIRED_MESON_FLAG1) |
||||
set_property(TARGET mesonTestLibDefs APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>) # Error empty string |
||||
set_property(TARGET mesonTestLibDefs APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS REQUIRED_MESON_FLAG2) |
||||
else() |
||||
set(ImportedTarget_FOUND OFF) |
||||
endif() |
@ -0,0 +1,18 @@ |
||||
#include<stdio.h> |
||||
#include<zlib.h> |
||||
|
||||
#ifndef REQUIRED_MESON_FLAG1 |
||||
#error "REQUIRED_MESON_FLAG1 not set" |
||||
#endif |
||||
|
||||
#ifndef REQUIRED_MESON_FLAG2 |
||||
#error "REQUIRED_MESON_FLAG2 not set" |
||||
#endif |
||||
|
||||
int main(int argc, char *argv[]) { |
||||
printf("Hello World\n"); |
||||
void * something = deflate; |
||||
if(something != 0) |
||||
return 0; |
||||
return 1; |
||||
} |
Loading…
Reference in new issue