# # # Main target set(ROOJSPACKER_MAIN_VALA_SOURCES main.vala) set(ROOJS_VALA_CUSTOM_VAPIS ${CMAKE_BINARY_DIR}/${LIBRARY_PATH}/${ROOJSPACKER_PKG_NAME}.vapi) set(ROOJSPACKER_VALA_PACKAGES glib-2.0 gobject-2.0 gee-0.8 posix gio-2.0 json-glib-1.0 ) # Compile Vala sources to C vala_precompile_target( "${PROJECT_NAME}-valabin" ROOJSPACKER_MAIN_C_SOURCES ${ROOJS_VALA_CUSTOM_VAPIS} ${ROOJSPACKER_MAIN_VALA_SOURCES} PACKAGES ${ROOJSPACKER_VALA_PACKAGES} DEPENDS "${ROOJSPACKER_LIBRARY_NAME}-vala") # Tell CMake to create an executable named "my-project" add_executable(${PROJECT_NAME} ${ROOJSPACKER_MAIN_C_SOURCES}) # Make sure the Vala sources are compiled to C before attempting to # build the executable. add_dependencies("${PROJECT_NAME}" "${PROJECT_NAME}-valabin") # We need to add the directory where the C header for our library is # installed, otherwise we'll get an error from the C compiler. set_target_properties(${PROJECT_NAME} PROPERTIES INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/roojspacker) # Any libraries that your tests need to link to should go here. # Usually this will just be your library. target_link_libraries(${PROJECT_NAME} ${ROOJSPACKER_LIBRARY_NAME}) # Install the executable. install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin # On Windows, the DLL goes in the same place as the executables LIBRARY DESTINATION lib # This is where shared libraries (*.so on Linux, *.dynlib on OS X) ARCHIVE DESTINATION lib) # Finally, this is where static libraries (*.a) go # Generate a .gitignore file(WRITE ".gitignore" "# Automatically generated by CMake, do not modify.\n") foreach(file ".gitignore" "roojspacker${CMAKE_EXECUTABLE_SUFFIX}") file(APPEND ".gitignore" "/${file}\n") endforeach(file) foreach(file ${ROOJSPACKER_MAIN_SOURCES}) string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" file ${file}) file(APPEND ".gitignore" "/${file}\n") endforeach(file)