Changeset 50 in pacpusframework for trunk/cmake/Findlog4cxx.cmake


Ignore:
Timestamp:
Jan 9, 2013, 9:06:15 AM (12 years ago)
Author:
Marek Kurdej
Message:

CMake: updated to conform to the coding style.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cmake/Findlog4cxx.cmake

    r8 r50  
    1212################################################################################
    1313
    14 INCLUDE (FindPackageHandleStandardArgs)
     14include(FindPackageHandleStandardArgs)
    1515
    1616# See if LOG4CXX_ROOT is not already set in CMake
    17 IF (NOT LOG4CXX_ROOT)
     17if(NOT LOG4CXX_ROOT)
    1818    # See if LOG4CXX_ROOT is set in process environment
    19     IF ( NOT $ENV{LOG4CXX_ROOT} STREQUAL "" )
    20         SET (LOG4CXX_ROOT "$ENV{LOG4CXX_ROOT}")
    21         MESSAGE (STATUS "Detected LOG4CXX_ROOT set to '${LOG4CXX_ROOT}'")
    22     ENDIF ()
    23 ENDIF ()
     19    if( NOT $ENV{LOG4CXX_ROOT} STREQUAL "" )
     20        SET(LOG4CXX_ROOT "$ENV{LOG4CXX_ROOT}")
     21        MESSAGE(STATUS "Detected LOG4CXX_ROOT set to '${LOG4CXX_ROOT}'")
     22    endif()
     23endif()
    2424
    25 SET (LOG4CXX_INC_LIST
    26   "/usr/include"
    27   "/usr/local/include"
     25set(LOG4CXX_INC_LIST
     26    "/usr/include"
     27    "/usr/local/include"
    2828)
    2929
    30 SET (LOG4CXX_LIB_LIST
    31   "/usr/lib"
    32   "/usr/local/lib"
     30set(LOG4CXX_LIB_LIST
     31    "/usr/lib"
     32    "/usr/local/lib"
    3333)
    3434
    3535# If LOG4CXX_ROOT is available, set up our hints
    36 IF (LOG4CXX_ROOT)
     36if(LOG4CXX_ROOT)
    3737    # Includes
    38     LIST (APPEND LOG4CXX_INC_LIST
     38    list(APPEND LOG4CXX_INC_LIST
    3939      "${LOG4CXX_ROOT}/include"
    4040      "${LOG4CXX_ROOT}"
    4141    )
    4242
    43     # Libraries (win32)
    44     IF (MSVC)
    45       # Visual Studio 2008
    46       IF (MSVC9)
    47         LIST (APPEND LOG4CXX_LIB_LIST "${LOG4CXX_ROOT}/lib/msvc2008")
    48       ENDIF ()
    49       # Visual Studio 2010
    50       IF (MSVC10)
    51         LIST (APPEND LOG4CXX_LIB_LIST "${LOG4CXX_ROOT}/lib/msvc2010")
    52       ENDIF ()
    53     ENDIF ()
     43    # Libraries win32
     44    if(MSVC)
     45        # Visual Studio 2008
     46        if(MSVC9)
     47            list(APPEND LOG4CXX_LIB_LIST "${LOG4CXX_ROOT}/lib/msvc2008")
     48        endif()
     49        # Visual Studio 2010
     50        if(MSVC10)
     51            list(APPEND LOG4CXX_LIB_LIST "${LOG4CXX_ROOT}/lib/msvc2010")
     52        endif()
     53    endif()
    5454
    55     # Libraries (all)
    56     LIST (APPEND LOG4CXX_LIB_LIST "${LOG4CXX_ROOT}/lib")
    57 ENDIF ()
     55    # Libraries all
     56    list(APPEND LOG4CXX_LIB_LIST "${LOG4CXX_ROOT}/lib")
     57endif()
    5858
    5959# Find headers
    60 FIND_PATH (
    61   LOG4CXX_INCLUDE_DIR
    62   NAMES
    63     log4cxx/log4cxx.h
    64   HINTS
    65     ${LOG4CXX_INC_LIST}
     60find_path(
     61    LOG4CXX_INCLUDE_DIR
     62    NAMES
     63        log4cxx/log4cxx.h
     64    HINTS
     65        ${LOG4CXX_INC_LIST}
    6666)
    6767
    6868# Find release library
    69 FIND_LIBRARY (
    70   LOG4CXX_LIBRARY
    71   NAMES
    72     log4cxx
    73   HINTS
    74     ${LOG4CXX_LIB_LIST}
     69find_library(
     70    LOG4CXX_LIBRARY
     71    NAMES
     72        log4cxx
     73    HINTS
     74        ${LOG4CXX_LIB_LIST}
    7575)
    7676
    7777# Find debug library, if on UNIX this is the same as release
    78 IF (WIN32)
    79   FIND_LIBRARY (LOG4CXXD_LIBRARY NAMES log4cxx_d HINTS ${LOG4CXX_LIB_LIST})
    80 ELSE ()
    81   SET (LOG4CXXD_LIBRARY ${LOG4CXX_LIBRARY})
    82 ENDIF ()
     78if(WIN32)
     79    find_library(LOG4CXXD_LIBRARY NAMES log4cxx_d HINTS ${LOG4CXX_LIB_LIST})
     80else()
     81    set(LOG4CXXD_LIBRARY ${LOG4CXX_LIBRARY})
     82endif()
    8383
    8484# Set LOG4CXX_FOUND honoring the QUIET and REQUIRED arguments
     
    8686
    8787# Output variables
    88 SET (LOG4CXX_LIBRARIES "")
    89 IF (LOG4CXX_FOUND)
    90   # Include dirs
    91   SET (LOG4CXX_INCLUDE_DIRS ${LOG4CXX_INCLUDE_DIR})
     88set(LOG4CXX_LIBRARIES "")
     89if(LOG4CXX_FOUND)
     90    # Include dirs
     91    set(LOG4CXX_INCLUDE_DIRS ${LOG4CXX_INCLUDE_DIR})
    9292
    93   # Release Libraries
    94   IF (LOG4CXX_LIBRARY)
    95     LIST(APPEND LOG4CXX_LIBRARIES optimized ${LOG4CXX_LIBRARY})
    96   ENDIF ()
    97  
    98   # Debug Libraries
    99   IF(LOG4CXXD_LIBRARY)
    100     LIST(APPEND LOG4CXX_LIBRARIES debug ${LOG4CXXD_LIBRARY})
    101   ENDIF()
     93    # Release Libraries
     94    if(LOG4CXX_LIBRARY)
     95        LIST(APPEND LOG4CXX_LIBRARIES optimized ${LOG4CXX_LIBRARY})
     96    endif()
    10297
    103   # Link dirs
    104   GET_FILENAME_COMPONENT (LOG4CXX_LIBRARY_DIRS ${LOG4CXX_LIBRARY} PATH)
    105 ENDIF ()
     98    # Debug Libraries
     99    if(LOG4CXXD_LIBRARY)
     100        LIST(APPEND LOG4CXX_LIBRARIES debug ${LOG4CXXD_LIBRARY})
     101    endif()
     102
     103    # Link dirs
     104    get_filename_component(LOG4CXX_LIBRARY_DIRS ${LOG4CXX_LIBRARY} PATH)
     105endif()
    106106
    107107# Advanced options for not cluttering the cmake UIs
    108 MARK_AS_ADVANCED (LOG4CXX_INCLUDE_DIR LOG4CXX_LIBRARY)
     108mark_as_advanced(LOG4CXX_INCLUDE_DIR LOG4CXX_LIBRARY)
Note: See TracChangeset for help on using the changeset viewer.