I am trying to add gettext to a C ++ project. It compiles and works fine under Linux, but I get a linker error with MinGW32 on the 64-bit version of Windows 7. I compile with cmake -G "MSYS Makefiles" ..because MinGW does not work due to nebula. I also tried a ninja.
In CMakeLists.txti have
find_package(Gettext REQUIRED
include_directories(${GETTEXT_INCLUDE_DIR})
if (INTL_FOUND)
find_package(INTL REQUIRED)
include_directories(${INTL_INCLUDE_DIR})
endif()
What is like
GETTEXT_INCLUDE_DIR = C:/MinGW/msys/1.0/local/include
The project compiles without problems, but then at the build stage I get the following errors:
<source file location> undefined reference to `libintl_gettext'
<source file location> undefined reference to `libintl_setlocale'
<source file location> undefined reference to `libintl_textdomain'
and etc.
I looked at https://www.gnu.org/software/gettext/FAQ.html#integrating_undefined
and added to the CMakeLists.txtfollowing:
SET(GCC_COVERAGE_COMPILE_FLAGS "-s -O2 -lintl")
SET(GCC_COVERAGE_LINK_FLAGS "-lintl")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}" )
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}
then i tried
SET(GCC_COVERAGE_COMPILE_FLAGS "-s -O2 -lintl -liconv -LC:/MinGW/msys/1.0/local/lib -IC:/MinGW/msys/1.0/local/include")
SET(GCC_COVERAGE_LINK_FLAGS "-lintl -liconv -LC:/MinGW/msys/1.0/local/lib -IC:/MinGW/msys/1.0/local/include")
which also did not work.