On 08/31/2010 03:03 PM, Christian Lohr wrote:
> Hi,
> I have a more or less complicated program to compile. It's splitted up
> in several small libraries, which have seperate directories for header
> and source files, and a main applikation.
> It compiled, but it ended up with a linker error, seems he couldn't
> link against OpenCASCADE and Qt properly.

Where do you link against the OPENCASCADE_LIBRARIES?

Regards,

Michael

> It's divided in:
> 
> applikation                     // <- is the main application, depends
> on "baselib", "importlib", "lodlib" and "representationlib"
> 
> baselib
> baselib/inc
> baselib/src
> 
> importlib                         // <- uses OpenCascade, and QtCore
> depends on "baselib"
> importlib/inc
> importlib/src
> 
> lodlib                               // <- uses QtCore(only the class
> QString), depends on "baselib"
> lodlib/inc
> lodlib/src
> 
> representationlib                // <- uses QtGui and QtOpenGL,
> depends on "baselib"
> representationlib/inc
> representationlib/src
> 
> -----------------------------------------lodlib/CMakeLists.txt
> ---------------------------------------------------------------------
> project(lodlib)
> 
> cmake_minimum_required(VERSION 2.6.0)
> find_package(Qt4 COMPONENTS QtCore REQUIRED)
> include(${QT_USE_FILE})
> 
> set(lodlib_SRCS
>       inc/drawsettings.h
>       inc/gridbox.h
>       inc/node.h
>       inc/quader.h
>       inc/vertextree.h
>       src/drawsettings.cpp
>       src/gridbox.cpp
>       src/node.cpp
>       src/quader.cpp
>       src/vertextree.cpp
> )
> 
> include_directories(${CMAKE_CURRENT_BINARY_DIR})
> add_library(lodlib STATIC ${lodlib_SRCS})
> 
> -------------------------------applikation/CMakeLists.txt
> ------------------------------------------------------------
> 
> project(applikation)
> 
> cmake_minimum_required(VERSION 2.6.0)
> find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL REQUIRED)
> include(${QT_USE_FILE})
> 
> set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR})
> find_package(OpenCASCADE REQUIRED)
> 
> set(applikations_SRCS
>       main.cpp
> )
> 
> include_directories(${CMAKE_CURRENT_BINARY_DIR})
> 
> add_executable(applikation ${applikations_SRCS})
> target_link_libraries(applikation ${QT_LIBRARIES})
> target_link_libraries(applikation baselib importlib lodlib representationlib)
> 
> -------------------------------------------------
> baselib/CMakeLists.txt
> ----------------------------------------------------------------------------------
> 
> project(baselib)
> 
> cmake_minimum_required(VERSION 2.6.0)
> 
> set(baselib_SRCS
>       inc/triangle.h
>       inc/vector3f.h
>       inc/vertex3f.h
>       src/vector3f.cpp
>       src/vertex3f.cpp
> )
> 
> add_library(baselib STATIC ${baselib_SRCS})
> 
> --------------------------------------------- importlib/CMakeLists.txt
> ---------------------------------------------------------------------------------------
> 
> project(importlib)
> 
> cmake_minimum_required(VERSION 2.6.0)
> find_package(Qt4 COMPONENTS QtCore REQUIRED)
> 
> # OpenCASCADE
> set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR})
> find_package(OpenCASCADE REQUIRED)
> 
> include(${QT_USE_FILE})
> 
> set(importlib_SRCS
>       inc/abstractreader.h
>       inc/stepreader.h
>       inc/stlreader.h
>       src/abstractreader.cpp
>       src/stepreader.cpp
>       src/stlreader.cpp
> )
> 
> include_directories(${CMAKE_CURRENT_BINARY_DIR})
> add_library(importlib STATIC ${importlib_SRCS})
> 
> --------------------------------------------
> representationlib/CMakeLists.txt
> ------------------------------------------------------------------------------------------
> 
> project(representationlib)
> 
> cmake_minimum_required(VERSION 2.6.0)
> 
> find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL REQUIRED)
> include(${QT_USE_FILE})
> 
> set(representationlib_SRCS
>       src/representationwindow.cpp
> )
> 
> set(representationlib_HDRS
>       inc/representationwindow.h
> )
> 
> qt4_wrap_cpp(representationlib_SRCS ${representationlib_HDRS})
> include_directories(${CMAKE_CURRENT_BINARY_DIR})
> 
> add_library(representationlib STATIC ${representationlib_SRCS})
> 
> ----------------------------------------------- ./CMakeLists.txt
> -----------------------------------------------------------------------------------------------
> 
> project(PackAssi)
> 
> cmake_minimum_required(VERSION 2.6.0)
> 
> include_directories(baselib/inc)
> include_directories(importlib/inc)
> include_directories(lodlib/inc)
> include_directories(representationlib/inc)
> 
> link_directories(baselib/src)
> link_directories(importlib/src)
> link_directories(lodlib/src)
> link_directories(representationlib/src)
> 
> add_subdirectory(applikation)
> add_subdirectory(baselib)
> add_subdirectory(importlib)
> add_subdirectory(lodlib)
> add_subdirectory(representationlib)
> 
> ---------------------------------------------------------
> FindOpenCASCADE.cmake (several places)
> ---------------------------------------------
> # - try to find OpenCascade Library and include files
> # OPENCASCADE_INCLUDE_DIR where to find Standard.hxx, etc.
> # OPENCASCADE_LIBRARIES libraries to link against
> # OPENCASCADE_FOUND If false, do not try to use OPENCASCADE
> 
> #=============================================================================
> # This software is distributed WITHOUT ANY WARRANTY; without even the
> # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> # See the License for more information.
> #
> # Created by Christian Lohr
> #=============================================================================
> 
> FIND_PATH ( OPENCASCADE_INCLUDE_DIR Standard.hxx PATHS
>                 /usr/include/opencascade
>                 /usr/local/include/opencascade
>                 $ENV{CASROOT}/inc
> )
> 
> INCLUDE_DIRECTORIES(/usr/include/opencascade ${OPENCASCADE_INCLUDE_DIR})
> 
> IF( WIN32 )
>         ADD_DEFINITIONS(-DWNT)
> ENDIF( WIN32 )
> 
> FIND_LIBRARY( OPENCASCADE_LIB_TKERNEL         NAMES TKernel PATHS
> $ENV{CASROOT}/win32/lib)
> FIND_LIBRARY( OPENCASCADE_LIB_TKMATH          NAMES TKMath PATHS
> $ENV{CASROOT}/win32/lib)
> FIND_LIBRARY( OPENCASCADE_LIB_TKSTEP          NAMES TKSTEP PATHS
> $ENV{CASROOT}/win32/lib)
> FIND_LIBRARY( OPENCASCADE_LIB_TKSTL           NAMES TKSTL PATHS 
> $ENV{CASROOT}/win32/lib)
> FIND_LIBRARY( OPENCASCADE_LIB_TKXBASE         NAMES TKXSBase PATHS
> $ENV{CASROOT}/win32/lib)
> FIND_LIBRARY( OPENCASCADE_LIB_TKTOPALGO               NAMES TKTopAlgo PATHS
> $ENV{CASROOT}/win32/lib)
> FIND_LIBRARY( OPENCASCADE_LIB_TKBREP          NAMES TKBRep PATHS
> $ENV{CASROOT}/win32/lib)
> 
> SET( OPENCASCADE_LIBRARIES ${OPENCASCADE_LIBRARIES}
>         ${OPENCASCADE_LIB_TKERNEL}
>         ${OPENCASCADE_LIB_TKMATH}
>         ${OPENCASCADE_LIB_TKSTEP}
>         ${OPENCASCADE_LIB_TKSTL}
>         ${OPENCASCADE_LIB_TKXBASE}
>         ${OPENCASCADE_LIB_TKTOPALGO}
>         ${OPENCASCADE_LIB_TKBREP}
> )
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to