My CMake modules, scripts, templates
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.6 KiB

INCLUDE (FindVala)
INCLUDE (UseVala)
INCLUDE (CFlagsCommonRules)
FIND_PACKAGE (PkgConfig REQUIRED)
IF (NOT LibNoApi)
SET (export_vaapi "--vapi=${LibName}-${MAJOR}.vapi")
SET (generate_header ${LibName}-${MAJOR})
ENDIF (NOT LibNoApi)
IF (WIN32)
IF (NOT LibIsPlugin)
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/run") # Avoid of "dll not found" messages
ENDIF (NOT LibIsPlugin)
ENDIF (WIN32)
VALA_PRECOMPILE (VALA_C ${LibSources}
PACKAGES ${LibPackages}
OPTIONS ${LibValaOpts} ${VALA_DEBUG} ${export_vaapi} --abi-stability
CUSTOM_VAPIS ${LibCustomVapis}
GENERATE_VAPI
GENERATE_HEADER ${generate_header}
)
IF (NOT "${LibPkgModules}" STREQUAL "")
PKG_CHECK_MODULES (PKGS REQUIRED ${LibPkgModules})
ENDIF ()
INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/po)
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)
SET (install_prefix "")
IF (LibIsPlugin)
SET (install_prefix "/${LibInstallPrefix}")
ENDIF (LibIsPlugin)
SET (lib "lib")
IF(UNIX)
IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
SET (lib "lib64")
ENDIF()
ENDIF(UNIX)
IF (UNIX)
SET (install_dest ${lib}${install_prefix})
#INCLUDE (GNUInstallDirs)
#SET (install_dest ${CMAKE_INSTALL_FULL_LIBDIR}${install_prefix})
ELSEIF (WIN32)
SET (install_dest bin${install_prefix})
ENDIF (UNIX)
IF (LibInstall)
IF (LibNoApi)
INSTALL (TARGETS ${LibName} RUNTIME DESTINATION ${install_dest}
LIBRARY DESTINATION ${install_dest})
ELSE (LibNoApi)
INSTALL (TARGETS ${LibName} RUNTIME DESTINATION ${install_dest}
LIBRARY DESTINATION ${install_dest}
ARCHIVE DESTINATION ${lib})
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 (LibNoApi)
ENDIF (LibInstall)
# Access to 'share' directory when debugging (Gettext, Glade, GSchema files, etc...)
IF (NOT LibIsPlugin)
EXECUTE_PROCESS (COMMAND ln -sf ${CMAKE_BINARY_DIR}/share -t ${CMAKE_CURRENT_BINARY_DIR}/..)
ENDIF (NOT LibIsPlugin)