View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013691CMakeModulespublic2012-11-16 15:212013-04-17 08:54
ReporterHerbert Thielen 
Assigned ToRolf Eike Beer 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake 2.8.10.1 
Target VersionCMake 2.8.10.2Fixed in VersionCMake 2.8.10.2 
Summary0013691: FindGettext.cmake does not set GETTEXT_FOUND on success
DescriptionWhen using "find_package(Gettext)", the variable GETTEXT_FOUND is not set even if the gettext tools are installed and can be found.
Steps To ReproduceUse a CMakeLists.txt with e.g.

===== snip =====
find_package(Gettext)
if (GETTEXT_FOUND)
  message (WARNING "All is fine, gettext found.")
else (GETTEXT_FOUND)
  message (WARNING "Did not find gettext.")
endif (GETTEXT_FOUND)
===== snap =====

and run 'cmake --trace path/to/project/dir'. The FindGettext.cmake modules tells you when msgmerge etc. are found, but even if the tools are found, the output of the lines above will be "Did not find gettext" because GETTEXT_FOUND is not set in the scope of CMakeLists.txt.

Probably this is not related to Windows, but I didn't try this version on other platforms.
Additional InformationThe following patch helped:

$ diff -u FindGettext.cmake~ FindGettext.cmake
--- FindGettext.cmake~ 2012-11-06 20:45:28.000000000 +0100
+++ FindGettext.cmake 2012-11-16 17:57:47.139133300 +0100
@@ -210,4 +210,4 @@

 endfunction()

-set(GETTEXT_FOUND ${Gettext_FOUND})
+set(GETTEXT_FOUND ${Gettext_FOUND} PARENT_SCOPE)
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0031583)
Rolf Eike Beer (developer)
2012-11-16 15:38

This change is wrong, no Find*.cmake module sets this variable in PARENT_SCOPE.
(0031584)
Herbert Thielen (reporter)
2012-11-16 15:48

Sorry, I'm not an experienced cmake script developer. At least it helped for me, the problem root cause may be something else.
(0031592)
Amine Chadly (reporter)
2012-11-17 05:17

Herbert, it does looks like you calling the FindGettext from the wrong scope don't you think ?
(0031676)
Dmitrijs Ledkovs (reporter)
2012-11-22 05:47

This now fails:
if ("${GETTEXT_FOUND}" STREQUAL "TRUE")

Please use:
if (GETTEXT_FOUND)

This one works with both old and new CMake.

@Developers close as invalid/won't fix? Is this change appropriate in a point release? It breaks previously working CMakeLists.txt.
(0031677)
Herbert Thielen (reporter)
2012-11-22 06:59

@Amine: What exactly do you mean with 'from the wrong scope'? The line
  find_package(Gettext)
is the first statement in CMakeLists.txt which resides in a subdirectory of my source tree. In the same CMakeLists.txt, there is a sequence
  if (GETTEXT_FOUND)
  ...
  else (GETTEXT_FOUND)
    message (WARNING "Did not find gettext, will not create message object")
  endif (GETTEXT_FOUND)

@Ddmitrijs: I'm using 'if (GETTEXT_FOUND)' - something else wrong?


If I run cmake in the build directory, I get
  $ cmake --version
  cmake version 2.8.10.1
  $ cmake -DCMAKE_BUILD_TYPE=Debug ..
  -- Found Gettext: /usr/bin/msgmerge (found version "0.18.1")
  CMake Warning at src/locale/CMakeLists.txt:69 (message):
    Did not find gettext, will not create message object
  
  
  -- Configuring done
  -- Generating done
  -- Build files have been written to: ...


Using cmake 2.8.7 (as available in Ubuntu 12.04 64-Bit), all is fine:


$ cmake --version
cmake version 2.8.7
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found Gettext: /usr/bin/msgmerge
-- Configuring done
-- Generating done
-- Build files have been written to: ...
(0031678)
Dmitrijs Ledkovs (reporter)
2012-11-22 12:19

Well, quite. I now believe this is a bug in cmake.

OpenSUSE applied this patch:
http://www.mail-archive.com/opensuse-commit@opensuse.org/msg28785.html [^]

And so do I in Ubuntu Raring right now.

GETTEXT_FOUND is not set to anything it appears in the 2.8.10.1. CMake developers please fix. This is now critical.

Ubuntu & OpenSUSE have now patched this issue in cmake, but other platforms are affected.
(0031679)
Dmitrijs Ledkovs (reporter)
2012-11-22 12:23

(also mantis fails to correctly parse urls with @ in them)
(0031701)
Rolf Eike Beer (developer)
2012-11-25 09:30

Fix merged to next:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=94f37851ef5c6dccbe2dd647a3b38e3196393298 [^]
(0031706)
Brad King (manager)
2012-11-26 08:58

Rebased fix on a pre-2.8.10 commit:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a7be2534 [^]
(0032885)
Robert Maynard (manager)
2013-04-17 08:54

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-11-16 15:21 Herbert Thielen New Issue
2012-11-16 15:38 Rolf Eike Beer Note Added: 0031583
2012-11-16 15:48 Herbert Thielen Note Added: 0031584
2012-11-17 05:17 Amine Chadly Note Added: 0031592
2012-11-22 05:47 Dmitrijs Ledkovs Note Added: 0031676
2012-11-22 06:59 Herbert Thielen Note Added: 0031677
2012-11-22 12:19 Dmitrijs Ledkovs Note Added: 0031678
2012-11-22 12:23 Dmitrijs Ledkovs Note Added: 0031679
2012-11-25 09:30 Rolf Eike Beer Note Added: 0031701
2012-11-25 09:30 Rolf Eike Beer Assigned To => Rolf Eike Beer
2012-11-25 09:30 Rolf Eike Beer Status new => resolved
2012-11-25 09:30 Rolf Eike Beer Resolution open => fixed
2012-11-25 09:30 Rolf Eike Beer OS Windows =>
2012-11-25 09:30 Rolf Eike Beer OS Version Windows 7 =>
2012-11-25 09:30 Rolf Eike Beer Platform Microsoft =>
2012-11-25 09:30 Rolf Eike Beer Fixed in Version => CMake 2.8.11
2012-11-25 09:30 Rolf Eike Beer Target Version => CMake 2.8.11
2012-11-25 09:30 Rolf Eike Beer Summary FindGettext.cmake does not set GETTEXT_FOUND in PARENT_SCOPE => FindGettext.cmake does not set GETTEXT_FOUND on success
2012-11-26 08:58 Brad King Note Added: 0031706
2012-11-27 15:23 David Cole Fixed in Version CMake 2.8.11 => CMake 2.8.10.2
2012-11-27 15:23 David Cole Target Version CMake 2.8.11 => CMake 2.8.10.2
2013-04-17 08:54 Robert Maynard Note Added: 0032885
2013-04-17 08:54 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team