Patch #696

cmake: out of src compilation

Added by Nikolai Saoukh about 7 years ago. Updated almost 4 years ago.

Status:ClosedStart date:14 Apr 2010
Priority:NormalDue date:
Assignee:Gilles Caulier% Done:

0%

Category:build
Target version:0.24

Description

This set of patches allows out of the source tree compilation.
Something like

add_subdirectory(..../exiv2 exiv2)

Little bit of iconv handling changes is included.

out-of-src.patch Magnifier (6.03 KB) Nikolai Saoukh, 14 Apr 2010 02:22


Related issues

Related to Exiv2 - Feature #536: Switch to a unified build system based on cmake Closed

Associated revisions

Revision 2111
Added by Gilles Caulier about 7 years ago

apply partially patch from Nikolai Saoukh, BUG #696

History

#1 Updated by Gilles Caulier about 7 years ago

Nikolai Saoukh wrote:

This set of patches allows out of the source tree compilation.
Something like

add_subdirectory(..../exiv2 exiv2)

Little bit of iconv handling changes is included.

Why cmake crash under Linux when your patch is applied ?

exiv2]$ cmake . DCMAKE_BUILD_TYPE=debugfull -DCMAKE_INSTALL_PREFIX=/usr
-
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
-- Looking for iconv_open
-- Looking for iconv_open - found
-- Performing Test ICONV_COMPILES
-- Performing Test ICONV_COMPILES - Success
-- Found ICONV: In glibc
-- Performing Test ICONV_ACCEPTS_NONCONST_INPUT
-- Performing Test ICONV_ACCEPTS_NONCONST_INPUT - Success
-- Performing Test ICONV_ACCEPTS_CONST_INPUT
-- Performing Test ICONV_ACCEPTS_CONST_INPUT - Failed
-- Found ZLIB: /usr/lib/libz.so
-- Found EXPAT: /usr/lib/libexpat.so
================> ICONV_LIBRARIES :
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for libintl.h
-- Looking for libintl.h - found
-- Looking for malloc.h
-- Looking for malloc.h - found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for iconv.h
-- Looking for iconv.h - found
-- Looking for stdbool.h
-- Looking for stdbool.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for wchar.h
-- Looking for wchar.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for process.h
-- Looking for process.h - not found
-- Looking for alarm
-- Looking for alarm - found
-- Looking for gmtime_r
-- Looking for gmtime_r - found
-- Looking for malloc
-- Looking for malloc - found
-- Looking for memset
-- Looking for memset - found
-- Looking for mmap
-- Looking for mmap - found
-- Looking for munmap
-- Looking for munmap - found
-- Looking for realloc
-- Looking for realloc - found
-- Looking for strchr
-- Looking for strchr - found
-- Looking for strchr_r
-- Looking for strchr_r - not found
-- Looking for strerror
-- Looking for strerror - found
-- Looking for strerror_r
-- Looking for strerror_r - found
-- Looking for strtol
-- Looking for strtol - found
-- Looking for timegm
-- Looking for timegm - found
-- Looking for vprintf
-- Looking for vprintf - found
-- None:
-- Debug: g
-
Release: O3 -DNDEBUG
-
RelWithDebInfo: O2 -g
-
MinSizeRel: Os -DNDEBUG
-
Looking for _Bool
-- Looking for _Bool - not found.
-- Performing Test TM_IN_SYS_TIME
-- Performing Test TM_IN_SYS_TIME - Failed
-- Performing Test STRERROR_R_CHAR_P
-- Performing Test STRERROR_R_CHAR_P - Success
-- Performing Test TIME_WITH_SYS_TIME
-- Performing Test TIME_WITH_SYS_TIME - Success
-- -------------------------------------------------------------
-- Building PNG support: YES
-- Building shared library: YES
-- XMP metadata support: YES
-- Building static libxmp: NO
-- Native language support: YES
-- Conversion of Windows XP tags: YES
-- Nikon lens database: YES
-- commercial build: NO
-- -------------------------------------------------------------
----------------> ICONV_LIBRARIES :
Segmentation fault

Gilles Caulier

#2 Updated by Gilles Caulier about 7 years ago

Nikolai Saoukh wrote:

This set of patches allows out of the source tree compilation.
Something like

add_subdirectory(..../exiv2 exiv2)

Little bit of iconv handling changes is included.

For info, i use Mandriva 2010.0 :

cmake --version
cmake version 2.8.0-rc3

Gilles Caulier

#3 Updated by Nikolai Saoukh about 7 years ago

Time to upgrade to release version of cmake-2.8.0? Or to 2.8.1 already released?

Mine cmake-2.8.0 from ports.

#4 Updated by Gilles Caulier about 7 years ago

Nikolai Saoukh wrote:

Time to upgrade to release version of cmake-2.8.0? Or to 2.8.1 already released?

Mine cmake-2.8.0 from ports.

Nikolai,

Cmake crash with this line :

set(EXIV2_FOUND true PARENT_SCOPE)

In fact, "PARENT_SCOPE" is weird there. All code relevant is

  1. # Compatibility settings for interoperability with FindExiv2.cmake
    set(EXIV2_FOUND true PARENT_SCOPE)
    set(EXIV2_LIBRARY exiv2 PARENT_SCOPE)
    set(EXIV2_INCLUDE_DIR
    ${CMAKE_CURRENT_BINARY_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/src PARENT_SCOPE)
    set(EXIV2_LIBRARIES exiv2 ${XMPLIB} PARENT_SCOPE)

All the rest of your patch is fine.

Please re-write this part properly, and explain better what you do with this code. Thanks in advance

Gilles Caulier

#5 Updated by Nikolai Saoukh about 7 years ago

Crashes or issue warning like this?

CMake Warning (dev) at CMakeLists.txt:108 (set):
Cannot set "EXIV2_FOUND": current scope has no parent.
This warning is for project developers. Use -Wno-dev to suppress it.

If warning, then it harmless.

PARENT_SCOPE is for the case where in external project one can write

add_subdirectory(..../exiv2 exiv2)

if(EXIV2_FOUND)
include_directories(... ${EXIV2_INCLUDE_DIR})
target_link_libraries(... ${EXIV2_LIBRARIES})
...
if(EXIV2_FOUND)

#6 Updated by Gilles Caulier about 7 years ago

Nikolai Saoukh wrote:

Crashes or issue warning like this?

CMake Warning (dev) at CMakeLists.txt:108 (set):
Cannot set "EXIV2_FOUND": current scope has no parent.
This warning is for project developers. Use -Wno-dev to suppress it.

If warning, then it harmless.

PARENT_SCOPE is for the case where in external project one can write

add_subdirectory(..../exiv2 exiv2)

if(EXIV2_FOUND)
include_directories(... ${EXIV2_INCLUDE_DIR})
target_link_libraries(... ${EXIV2_LIBRARIES})
...
if(EXIV2_FOUND)

Cmake crash as well. I cannot see any warnings there.

In all case, no warnings must be generated...

Gilles

#7 Updated by Nikolai Saoukh about 7 years ago

cmake crash should be reported to cmake developers. No clues about the nature of the crash.

Warning is just the warning.

#8 Updated by Gilles Caulier about 7 years ago

Nikolai Saoukh wrote:

cmake crash should be reported to cmake developers. No clues about the nature of the crash.

Warning is just the warning.

Hum...

What do you want to do with this code exactly :

  1. # Compatibility settings for interoperability with FindExiv2.cmake
    set(EXIV2_FOUND true PARENT_SCOPE)
  2. set(EXIV2_LIBRARY exiv2 PARENT_SCOPE)
  3. set(EXIV2_INCLUDE_DIR
  4. ${CMAKE_CURRENT_BINARY_DIR}
  5. ${CMAKE_CURRENT_SOURCE_DIR}/src PARENT_SCOPE)
  6. set(EXIV2_LIBRARIES exiv2 ${XMPLIB} PARENT_SCOPE)

Gilles

#9 Updated by Nikolai Saoukh about 7 years ago

What do you want to do with this code exactly :

  1. # Compatibility settings for interoperability with FindExiv2.cmake
    set(EXIV2_FOUND true PARENT_SCOPE)
  2. set(EXIV2_LIBRARY exiv2 PARENT_SCOPE)
  3. set(EXIV2_INCLUDE_DIR
  4. ${CMAKE_CURRENT_BINARY_DIR}
  5. ${CMAKE_CURRENT_SOURCE_DIR}/src PARENT_SCOPE)
  6. set(EXIV2_LIBRARIES exiv2 ${XMPLIB} PARENT_SCOPE)

I already answered in #6.

Feel free to remove this part if it still confuses you.

#10 Updated by Gilles Caulier about 7 years ago

Nikolai Saoukh wrote:

What do you want to do with this code exactly :

  1. # Compatibility settings for interoperability with FindExiv2.cmake
    set(EXIV2_FOUND true PARENT_SCOPE)
  2. set(EXIV2_LIBRARY exiv2 PARENT_SCOPE)
  3. set(EXIV2_INCLUDE_DIR
  4. ${CMAKE_CURRENT_BINARY_DIR}
  5. ${CMAKE_CURRENT_SOURCE_DIR}/src PARENT_SCOPE)
  6. set(EXIV2_LIBRARIES exiv2 ${XMPLIB} PARENT_SCOPE)

I already answered in #6.

Feel free to remove this part if it still confuses you.

Ok, patch pplied partially with commit #2111.

In whole KDE project, where i work normally for the rest of my open source contributions, we never use PARENT_SCOPE macro.

I removed this code from your patch.

Gilles Caulier

#11 Updated by Gilles Caulier about 7 years ago

Gilles Caulier wrote:

Nikolai Saoukh wrote:

What do you want to do with this code exactly :

  1. # Compatibility settings for interoperability with FindExiv2.cmake
    set(EXIV2_FOUND true PARENT_SCOPE)
  2. set(EXIV2_LIBRARY exiv2 PARENT_SCOPE)
  3. set(EXIV2_INCLUDE_DIR
  4. ${CMAKE_CURRENT_BINARY_DIR}
  5. ${CMAKE_CURRENT_SOURCE_DIR}/src PARENT_SCOPE)
  6. set(EXIV2_LIBRARIES exiv2 ${XMPLIB} PARENT_SCOPE)

I already answered in #6.

Feel free to remove this part if it still confuses you.

Ok, patch pplied partially with commit #2111.

In whole KDE project, where i work normally for the rest of my open source contributions, we never use PARENT_SCOPE macro.

I removed this code from your patch.

Gilles Caulier

Nikolai,

If you want to contribute and help me to finalize Exiv2 CMake port, Andreas plan to switch fully to Cmake with 0.20 release, not 0.19.1.

There are some codes to do to complete port. There is a TODO-CMAKE file in svn (i need to review it again)...

From my side, they still 2 important tasks to do : Documentation build with Doxygen, through CMake. I have this code in digiKam CMake implementation, and i will backport it.

The more complex cmake pending stuff to do is i18n extraction to generate .po files. I have take a look into other library managed with CMake, as OpenCV, but i cannot see this stuff.

In KDE project, .po file are generated through scripts, outside CMake. We can backport it to Exiv2, but this can be complicated to do and not portable. If a pure CMake solution exist, i prefer use it.

As Exiv2 compile fine under Linux, Mingw32, and VisualC++ using Cmake, i think the first stage (compilation) is fine. Of course, as usual, the pending 10% job to do to complete are the most difficult to achieve (:=)))

Gilles Caulier

#12 Updated by Gilles Caulier about 7 years ago

  • Status changed from New to Resolved

#13 Updated by Robin Mills almost 4 years ago

  • Category set to build
  • Status changed from Resolved to Closed
  • Assignee set to Gilles Caulier
  • Priority changed from Low to Normal
  • Target version set to 0.24

Fixed in 0.24.

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux