cmake.backbone/ValaLibCommonRules.cmake

41 lines
1.6 KiB
CMake

INCLUDE (FindVala)
INCLUDE (UseVala)
INCLUDE (CFlags)
FIND_PACKAGE (PkgConfig REQUIRED)
IF (WIN32)
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/run") # Avoid of "dll not found" messages
ENDIF (WIN32)
VALA_PRECOMPILE (VALA_C ${LibSources}
PACKAGES ${LibPackages}
OPTIONS --thread ${VALA_DEBUG} --vapi=${LibName}-${MAJOR}.vapi
CUSTOM_VAPIS ${LibCustomVapis}
GENERATE_VAPI
GENERATE_HEADER ${LibName}-${MAJOR}
)
PKG_CHECK_MODULES (PKGS REQUIRED ${LibPkgModules})
INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS})
ADD_LIBRARY (${LibName} SHARED ${VALA_C} ${LibExtraSources})
ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${PROJECT_LOWERCASE_NAME}-${MAJOR}")
TARGET_LINK_LIBRARIES (${LibName} ${PKGS_LIBRARIES} ${LibLinkLibs})
SET_TARGET_PROPERTIES (${LibName} PROPERTIES VERSION ${MAJOR}.${MINOR}.${PATCH})
SET_TARGET_PROPERTIES (${LibName} PROPERTIES SOVERSION ${MAJOR})
IF (WIN32)
SET_TARGET_PROPERTIES (${LibName} PROPERTIES PREFIX "" IMPORT_PREFIX ""
SUFFIX "-${MAJOR}.dll" IMPORT_SUFFIX "-${MAJOR}.dll.a")
ENDIF (WIN32)
IF (LibInstall)
IF (UNIX)
INSTALL (TARGETS ${LibName} DESTINATION lib)
ELSEIF (WIN32)
INSTALL (TARGETS ${LibName}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
ENDIF (UNIX)
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${LibName}-${MAJOR}.h DESTINATION include)
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${LibName}-${MAJOR}.vapi DESTINATION share/vala/vapi)
ENDIF (LibInstall)