[CMake] Questions on CMAKE_CONFIGURATION_TYPES
Mathieu Malaterre
mathieu.malaterre at gmail.com
Thu Mar 25 08:50:14 EDT 2010
On Thu, Mar 25, 2010 at 12:51 PM, Michael Schildt
<michael.schildt at ifn-magdeburg.de> wrote:
>>
>> On Wed, Mar 24, 2010 at 2:10 PM, John Drescher <drescherjm at gmail.com
>> <http://www.cmake.org/mailman/listinfo/cmake>> wrote:
>> >/ On Wed, Mar 24, 2010 at 1:42 PM, Michael Schildt
>> />/ <michael.schildt at ifn-magdeburg.de
>> <http://www.cmake.org/mailman/listinfo/cmake>> wrote:
>> />>/ Hello,
>> />>/
>> />>/ I use GDCM libaries in one project. Unfurtunally, i couldn't find a
>> findGDCM
>> />>/ module and i'm not experienced enough to write one. I have seen that
>> GDCM is
>> />>/ used in ITK, so there must be a module like this. GDCM is using cmake
>> too,
>> />>/ so inclusion should be easy. But i have problems to link the correkt
>> library
>> />>/ version depending on the configuration type.
>> />>/
>> />>/ IF(WIN32)
>> />>/ INCLUDE_DIRECTORIES(C:/Programme/GDCM\ 2.0/include/gdcm-2.0)
>> />>/ IF(CMAKE_BUILD_TYPE MATCHES "Debug")
>> />>/ LINK_DIRECTORIES("C:/Program Files/GDCM/bin/Debug")
>> />>/ ELSE(CMAKE_BUILD_TYPE MATCHES "Debug")
>> />>/ LINK_DIRECTORIES("C:/Program Files/GDCM/bin/Release")
>> />>/ ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug")
>> />>/ SET(GDCM_LIBRARIES gdcmcharls.lib gdcmCommon.lib gdcmDICT.lib
>> gdcmDSED.lib
>> />>/ gdcmexpat.lib gdcmgetopt.lib gdcmIOD.lib gdcmjpeg8.lib gdcmjpeg12.lib
>> />>/ gdcmjpeg16.lib gdcmMSFF.lib gdcmopenjpeg.lib gdcmzlib.lib)
>> />>/ ELSE(WIN32)
>> />>/ # Linux
>> />>/ INCLUDE_DIRECTORIES(/usr/include/gdcm-2.0)
>> />>/ SET(GDCM_LIBRARIES gdcmCommon gdcmDICT gdcmDSED gdcmIOD gdcmjpeg8
>> />>/ gdcmjpeg12 gdcmjpeg16 gdcmMSFF)
>> />>/ ENDIF(WIN32)
>> />>/
>> />>/ He always includes the Relase Directory. What is a solution for this
>> issue?
>> />>/
>> />/
>> />/ Build GDCM from source and it will have the necessary finders. Do not
>> />/ INSTALL. Then the usual in your CMakeLists.txt file. Here is an
>> />/ example.
>> />/
>> />/ CMakeLists.txt
>> />/ cmake_minimum_required(VERSION 2.6)
>> />/
>> />/ PROJECT(GDCMImageViewer)
>> />/
>> />/ FIND_PACKAGE(VTK REQUIRED)
>> />/ INCLUDE(${VTK_USE_FILE})
>> />/
>> />/ FIND_PACKAGE(GDCM REQUIRED)
>> />/ INCLUDE(${GDCM_USE_FILE})
>> />/
>> />/ INCLUDE_DIRECTORIES(
>> />/ ${GDCM_SOURCE_DIR}/Utilities/VTK
>> />/ )
>> />/
>> />/ IF(WIN32 AND NOT CYGWIN)
>> />/ ADD_SUBDIRECTORY(getopt)
>> />/ INCLUDE_DIRECTORIES(getopt)
>> />/ ENDIF(WIN32 AND NOT CYGWIN)
>> />/
>> />/ ADD_EXECUTABLE(GDCMImageViewer gdcmviewer.cxx)
>> />/ TARGET_LINK_LIBRARIES(GDCMImageViewer vtkHybrid vtkInfovis
>> vtkWidgets
>> />/ vtkgdcm getopt)
>> />/
>> />/
>> /
>> BTW when cmake-gui complains it can not find GDCM point it to the
>> place where you built gdcm. Also make sure you build all
>> configurations of GDCM that you want in the same build tree. That is
>> why I said do not install. Since install will try to put the binaries
>> in the same folder and since they are named the same it will cause
>> problems.
>>
>>
>> John
>>
>
> Hi,
>
> thanks for the useful hints, cmake finds the package now. But unfurtunally,
> it does not link the library and therefore i get a lot of unresolved
> dependency from gdcm. i replaced my stuff with
>
> FIND_PACKAGE(GDCM REQUIRED)
> INCLUDE(${GDCM_USE_FILE})
>
> and tested the typical variables
>
> MESSAGE(STATUS "Cmake GDCM: using GDCM includes at: ${GDCM_INCLUDE_DIR}")
> MESSAGE(STATUS "Cmake GDCM: using GDCM libraries: ${GDCM_LIBRARIES}")
> MESSAGE(STATUS "Cmake GDCM: using GDCM libraries: ${GDCM_LIBRARY}")
>
> but the are all empty? How can i find out, what is defined by GDCM?
`cmake --help-module` parses system installed Find*.cmake file,
however it does not parse *Config.cmake file. You have to look into
GDCMConfig.cmake and such to understand.
Anyway, there is no generic "GDCM_LIBRARIES", you have to specify
explicitely the name of the desired lib:
add_executable(dummy dummy.cxx)
target_link_libraries(dummy gdcmMSFF)
Cheers
--
Mathieu
More information about the CMake
mailing list