Author: mvidner Date: Mon Oct 3 17:23:12 2011 New Revision: 66195 URL: http://svn.opensuse.org/viewcvs/yast?rev=66195&view=rev Log: Reformatted to pass cmakelint (almost. how to split long lines?) http://code.google.com/p/cmake-lint/wiki/CMakeStyleGuide Modified: trunk/ruby-bindings/CMakeLists.txt trunk/ruby-bindings/src/CMakeLists.txt trunk/ruby-bindings/src/ruby/CMakeLists.txt Modified: trunk/ruby-bindings/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/yast/trunk/ruby-bindings/CMakeLists.txt?rev=66195&r1=66194&r2=66195&view=diff ============================================================================== --- trunk/ruby-bindings/CMakeLists.txt (original) +++ trunk/ruby-bindings/CMakeLists.txt Mon Oct 3 17:23:12 2011 @@ -4,73 +4,71 @@ cmake_minimum_required(VERSION 2.4) if(COMMAND cmake_policy) - # escape preprocessor, see -DVERSION below - cmake_policy(SET CMP0005 OLD) -endif(COMMAND cmake_policy) - -PROJECT(yast2-ruby-bindings) -SET(PACKAGE "yast2-ruby-bindings") -SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O3 -Wall -Woverloaded-virtual" ) -SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O3 -Wall" ) + # let cmake escape preprocessor definitions + cmake_policy(SET CMP0005 NEW) +endif() + +project(yast2-ruby-bindings) +set(PACKAGE "yast2-ruby-bindings") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O3 -Wall -Woverloaded-virtual") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O3 -Wall") # # Where is SWIG ? # -FIND_PACKAGE(SWIG) -IF ( NOT SWIG_FOUND ) - -FIND_PROGRAM(SWIG_EXECUTABLE - NAMES swig-1.3 swig - PATHS ${SWIG_DIR} ${SWIG_DIR}/.. ${SWIG_DIR}/../../bin /usr/bin /usr/local/bin ${CMAKE_INSTALL_PREFIX}/bin -) -ENDIF ( NOT SWIG_FOUND ) - -IF ( NOT SWIG_EXECUTABLE ) - MESSAGE( FATAL_ERROR "SWIG not found." ) -ELSE ( NOT SWIG_EXECUTABLE ) - MESSAGE( STATUS "SWIG found at ${SWIG_EXECUTABLE}" ) -ENDIF ( NOT SWIG_EXECUTABLE ) +find_package(SWIG) +if(NOT SWIG_FOUND) + find_program(SWIG_EXECUTABLE + NAMES swig-1.3 swig + PATHS ${SWIG_DIR} ${SWIG_DIR}/.. ${SWIG_DIR}/../../bin /usr/bin /usr/local/bin ${CMAKE_INSTALL_PREFIX}/bin) +endif() + +if(NOT SWIG_EXECUTABLE) + message(FATAL_ERROR "SWIG not found.") +else() + message(STATUS "SWIG found at ${SWIG_EXECUTABLE}") +endif() # # Where is YaST ? # -FIND_PACKAGE(Yast REQUIRED) -IF ( NOT YAST_LIBRARY ) - MESSAGE( FATAL_ERROR "Please install yast2-core-devel." ) -ENDIF ( NOT YAST_LIBRARY ) - -IF ( NOT YAST_PLUGIN_UI_LIBRARY ) - MESSAGE( FATAL_ERROR "YAST_PLUGIN_UI_LIBRARY not set, please install yast2-ycp-ui-bindings-devel." ) -ENDIF ( NOT YAST_PLUGIN_UI_LIBRARY ) +find_package(Yast REQUIRED) +if(NOT YAST_LIBRARY) + message(FATAL_ERROR "Please install yast2-core-devel.") +endif() + +if(NOT YAST_PLUGIN_UI_LIBRARY) + message(FATAL_ERROR "YAST_PLUGIN_UI_LIBRARY not set, please install yast2-ycp-ui-bindings-devel.") +endif() # # Where is Ruby ? # -FIND_PACKAGE(Ruby REQUIRED) -IF ( NOT RUBY_EXECUTABLE ) - MESSAGE( FATAL_ERROR "Ruby not found." ) -ENDIF ( NOT RUBY_EXECUTABLE ) +find_package(Ruby REQUIRED) +if(NOT RUBY_EXECUTABLE) + message(FATAL_ERROR "Ruby not found.") +endif() # # -> src/ # -ADD_SUBDIRECTORY(src) +add_subdirectory(src) # # -> tests/ # -INCLUDE(CTest) -ENABLE_TESTING() +include(CTest) +enable_testing() -ADD_SUBDIRECTORY(tests) +add_subdirectory(tests) # # packaging # -SET( RPMNAME "yast2-ruby-bindings" ) +set(RPMNAME "yast2-ruby-bindings") -GENERATE_PACKAGING(${RPMNAME} ${VERSION}) +generate_packaging(${RPMNAME} ${VERSION}) Modified: trunk/ruby-bindings/src/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/yast/trunk/ruby-bindings/src/CMakeLists.txt?rev=66195&r1=66194&r2=66195&view=diff ============================================================================== --- trunk/ruby-bindings/src/CMakeLists.txt (original) +++ trunk/ruby-bindings/src/CMakeLists.txt Mon Oct 3 17:23:12 2011 @@ -1,2 +1 @@ - -ADD_SUBDIRECTORY(ruby) \ No newline at end of file +add_subdirectory(ruby) Modified: trunk/ruby-bindings/src/ruby/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/yast/trunk/ruby-bindings/src/ruby/CMakeLists.txt?rev=66195&r1=66194&r2=66195&view=diff ============================================================================== --- trunk/ruby-bindings/src/ruby/CMakeLists.txt (original) +++ trunk/ruby-bindings/src/ruby/CMakeLists.txt Mon Oct 3 17:23:12 2011 @@ -1,7 +1,6 @@ +add_definitions(-DY2LOG=\"Ruby\") -ADD_DEFINITIONS(-DY2LOG=\\\"Ruby\\\") - -SET(yast_ruby_module_SRCS +set(yast_ruby_module_SRCS YCP.cc Y2RubyTypePath.cc # YCP.cc -> ryast_path_init() Y2RubyTypeTerm.cc # YCP.cc -> ryast_term_init() @@ -11,7 +10,7 @@ RubyLogger.h ) -SET(ruby_yast_plugin_SRCS +set(ruby_yast_plugin_SRCS RubyLogger.cc Y2CCRuby.cc Y2RubyComponent.cc @@ -23,7 +22,7 @@ Y2RubyUtils.cc ) -SET(ruby_yast_plugin_HEADERS +set(ruby_yast_plugin_HEADERS RubyLogger.h Y2CCRuby.h Y2RubyComponent.h @@ -34,12 +33,12 @@ Y2RubyTypeTerm.h ) -INCLUDE_DIRECTORIES( ${RUBY_INCLUDE_PATH} ) -INCLUDE_DIRECTORIES( ${YAST_INCLUDE_DIR} ) +include_directories( ${RUBY_INCLUDE_PATH} ) +include_directories( ${YAST_INCLUDE_DIR} ) -LINK_DIRECTORIES(${YAST_PLUGIN_DIR}) +link_directories(${YAST_PLUGIN_DIR}) -ADD_DEFINITIONS( ${CC_FLAGS} -Wno-deprecated) +add_definitions(${CC_FLAGS} -Wno-deprecated) # # Ruby -> YCP/YaST @@ -47,8 +46,9 @@ # -ADD_LIBRARY( ycpx SHARED ${yast_ruby_module_SRCS}) -SET_TARGET_PROPERTIES( ycpx PROPERTIES PREFIX "" ) +add_library(ycpx SHARED ${yast_ruby_module_SRCS}) +# libycpx.so -> ycpx.so +set_target_properties(ycpx PROPERTIES PREFIX "") # # Use rpath to find YaST plugin libs (wfm has static constructors :-( ) @@ -57,35 +57,35 @@ # tight control) CMake should be able to handle this. However, it somehow does # not work. # -#SET_TARGET_PROPERTIES( ycpx PROPERTIES SKIP_BUILD_RPATH FALSE) -#SET_TARGET_PROPERTIES( ycpx PROPERTIES BUILD_WITH_INSTALL_RPATH FALSE) -#SET_TARGET_PROPERTIES( ycpx PROPERTIES INSTALL_RPATH_USE_LINK_PATH FALSE) -#SET_TARGET_PROPERTIES( ycpx PROPERTIES INSTALL_RPATH "${YAST_PLUGIN_DIR}") +#set_target_properties( ycpx PROPERTIES SKIP_BUILD_RPATH FALSE) +#set_target_properties( ycpx PROPERTIES BUILD_WITH_INSTALL_RPATH FALSE) +#set_target_properties( ycpx PROPERTIES INSTALL_RPATH_USE_LINK_PATH FALSE) +#set_target_properties( ycpx PROPERTIES INSTALL_RPATH "${YAST_PLUGIN_DIR}") # # So using an explicit linker option instead: # (http://www.cmake.org/pipermail/cmake/2008-January/019321.html) # SET ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath,'${YAST_PLUGIN_DIR}'" ) -TARGET_LINK_LIBRARIES( ycpx ${YAST_LIBRARY} ) -TARGET_LINK_LIBRARIES( ycpx ${YAST_YCP_LIBRARY} ) +target_link_libraries( ycpx ${YAST_LIBRARY} ) +target_link_libraries( ycpx ${YAST_YCP_LIBRARY} ) # # The WFM and SCR component can only be initialized statically # (e.g. through Y2CCWFM), thus we must link against the plugin libs # and set the executables 'rpath' accordingly # -TARGET_LINK_LIBRARIES( ycpx ${YAST_PLUGIN_WFM_LIBRARY} ) -TARGET_LINK_LIBRARIES( ycpx ${YAST_PLUGIN_SCR_LIBRARY} ) -TARGET_LINK_LIBRARIES( ycpx ${YAST_PLUGIN_UI_LIBRARY} ) -TARGET_LINK_LIBRARIES( ycpx ${RUBY_LIBRARY} ) +target_link_libraries( ycpx ${YAST_PLUGIN_WFM_LIBRARY} ) +target_link_libraries( ycpx ${YAST_PLUGIN_SCR_LIBRARY} ) +target_link_libraries( ycpx ${YAST_PLUGIN_UI_LIBRARY} ) +target_link_libraries( ycpx ${RUBY_LIBRARY} ) -INSTALL(TARGETS ycpx LIBRARY DESTINATION ${RUBY_VENDORARCH_DIR} ) +install(TARGETS ycpx LIBRARY DESTINATION ${RUBY_VENDORARCH_DIR} ) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ycp.rb DESTINATION ${RUBY_VENDORLIB_DIR} ) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ycp.rb DESTINATION ${RUBY_VENDORLIB_DIR} ) # rdoc -SET(rdoc_dir "${CMAKE_CURRENT_BINARY_DIR}/html") +set(rdoc_dir "${CMAKE_CURRENT_BINARY_DIR}/html") ADD_CUSTOM_COMMAND ( OUTPUT ${rdoc_dir} COMMAND ${CMAKE_COMMAND} -E echo_append "Creating rdoc documentation ..." @@ -95,19 +95,17 @@ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/ruby DEPENDS ${CMAKE_SOURCE_DIR}/src/ruby/YCP.cc ${CMAKE_SOURCE_DIR}/src/ruby/*.rb ) -ADD_CUSTOM_TARGET(ruby_rdoc ALL DEPENDS "${rdoc_dir}") -ADD_DEPENDENCIES(ruby_rdoc ycpx) +add_custom_target(ruby_rdoc ALL DEPENDS "${rdoc_dir}") +add_dependencies(ruby_rdoc ycpx) # # YCP -> Ruby # libpy2lang_ruby (YCP plugin library) # -ADD_LIBRARY( py2lang_ruby SHARED ${ruby_yast_plugin_SRCS}) -TARGET_LINK_LIBRARIES( py2lang_ruby ${YAST_LIBRARY} ) -TARGET_LINK_LIBRARIES( py2lang_ruby ${YAST_YCP_LIBRARY} ) -TARGET_LINK_LIBRARIES( py2lang_ruby ${YAST_PLUGIN_WFM_LIBRARY} ) -TARGET_LINK_LIBRARIES( py2lang_ruby ${RUBY_LIBRARY} ) -INSTALL(TARGETS py2lang_ruby LIBRARY DESTINATION ${YAST_PLUGIN_DIR} ) - -#SET_TARGET_PROPERTIES( y2lang_ruby PROPERTIES PREFIX "" ) +add_library( py2lang_ruby SHARED ${ruby_yast_plugin_SRCS}) +target_link_libraries( py2lang_ruby ${YAST_LIBRARY} ) +target_link_libraries( py2lang_ruby ${YAST_YCP_LIBRARY} ) +target_link_libraries( py2lang_ruby ${YAST_PLUGIN_WFM_LIBRARY} ) +target_link_libraries( py2lang_ruby ${RUBY_LIBRARY} ) +install(TARGETS py2lang_ruby LIBRARY DESTINATION ${YAST_PLUGIN_DIR} ) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org