[CMake] FindICU.cmake setting ICU_FOUND to "FALSE" with quotes?

Kent Williams kwilliams at leepfrog.com
Mon Feb 10 17:12:32 EST 2020


I was trying to do this:

> find_package(ICU 59.1 QUIET
> COMPONENTS
> data
> i18n
> io
> tu
> uc
> )
> if(ICU_FOUND)
>   include_directories(BEFORE ${ICU_INCLUDE_DIRS})
>   message("ICU_LIBRARIES=${ICU_LIBRARIES}")
> endif()

And at configuration time, ICU_FOUND was turning up with double quotes 
around it, and as we all know from CMake 101, the string "FALSE" has a 
truth value of TRUE in the if statement.

This is with cmake 3.16.

I fixed this by changing the expression to

IF(ICU_FOUND AND NOT "${ICU_FOUND}" STREQUAL "\"FALSE\"")

but that doesn't seem right somehow!




More information about the CMake mailing list