# For last version of this code see
# http://qt.gitorious.org/qt-solutions/qt-solutions/trees/master/qtpropertybrowser

# Is this tool is compiled inside or outside CAMITK (as a standalone)?
if (NOT CEP_NAME STREQUAL "SDK")
  # if this tool is compiled independently from CamiTK
  set(QTPROPERTYBROWSER_STANDALONE ON CACHE BOOL "ON only if QTPROPERTYBROWSER compiled outside CAMITK SDK")
  message(SEND_ERROR "Compilation of QTPROPERTYBROWSER outside CamiTK SDK not supported yet. Please contact us.")
endif()

# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)

set(qtpropertyeditor_SRCS
  src/qtpropertybrowser.cpp
  src/qtpropertymanager.cpp
  src/qteditorfactory.cpp
  src/qtvariantproperty.cpp
  src/qttreepropertybrowser.cpp
  src/qtbuttonpropertybrowser.cpp
  src/qtgroupboxpropertybrowser.cpp
  src/qtpropertybrowserutils.cpp
)

include_directories(${CMAKE_CURRENT_BINARY_DIR}
                    ${CMAKE_CURRENT_BINARY_DIR}/src
                    ${QTPROPERTYBROWSER_SOURCE_DIR}/src
                    ${QT_INCLUDE_DIR}
)

qt_add_resources(
  qtpropertyeditor_RESOURCES
  src/qtpropertybrowser.qrc
)

qt_add_resources(RESOURCE_SRCS src/qtpropertybrowser.qrc)

set(SRCS ${extension_MOC}
  ${qtpropertyeditor_MOC}
  ${qtpropertyeditor_SRCS}
  ${qtpropertyeditor_RESOURCES}
)

add_definitions(-DCOMPILE_QTPROPERTYBROWSER)

# take all the headers for installation
file(GLOB HEADERS_H "src/*.h")
file(GLOB HEADERS_UPPERCASE "src/Qt*")

camitk_library(SHARED
               SOURCES ${SRCS}
               NEEDS_QT
               PUBLIC #install directly in lib (or bin for Windows).
               HEADERS_TO_INSTALL ${HEADERS_H} ${HEADERS_UPPERCASE} 
               CEP_NAME SDK
               DESCRIPTION "Allows displaying and editing Qt Meta Object properties. Used to display component properties. This library is required."
               )