Changeset 3119 for trunk/test_more


Ignore:
Timestamp:
Feb 25, 2014 6:52:41 AM (6 years ago)
Author:
bradbell
Message:

Improve CMakeLists.txt files.

CMakeLists.txt: use better name for list of check dependencies.
sources_libs_define.cmake: check for no definition case.
CMakeLists.txt: exclude eigen_lib from all, use check_depends.
CMakeLists.txt: use sources_libs_define to simplify.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test_more/CMakeLists.txt

    r3116 r3119  
    2121ADD_DEFINITIONS("-DCPPAD_MAX_NUM_THREADS=1")
    2222
    23 # sources that use adolc
    24 IF ( adolc_prefix )
    25         # Extra source files if we are including adolc
    26         SET(adolc_sources base_adolc.cpp)
    27         # Adds -D define flags to the compilation of source files.
    28         ADD_DEFINITIONS("-DCPPAD_ADOLC_TEST")
    29         # add adolc to list of libraries
    30         SET(test_more_adolc adolc)
    31 ELSE ( adolc_prefix )
    32         SET(adolc_sources "")
    33         SET(test_more_adolc "")
    34 ENDIF ( adolc_prefix )
     23# adolc_prefix
     24SET(sources base_adolc.cpp)
     25sources_libs_define(adolc "${sources}" adolc ADOLC_TEST)
    3526
    3627# colpack_prefix
    37 IF ( colpack_prefix )
    38         # Extra source files if we are including colpack
    39         SET(colpack_sources ../cppad/local/cppad_colpack.cpp)
    40         # add colpack to list of libraries
    41         SET(colpack_libs "ColPack")
    42 ELSE ( colpack_prefix )
    43         SET(colpack_sources "")
    44         SET(colpack_libs "")
    45 ENDIF ( colpack_prefix )
     28SET(sources ../cppad/local/cppad_colpack.cpp)
     29sources_libs_define(colpack "${sources}" ColPack COLPACK_TEST)
    4630
    47 # sources that use ipopt
    48 IF ( ipopt_prefix )
    49         # Extra source files if we are including ipopt
    50         SET(ipopt_sources ipopt_solve.cpp)
    51         # Adds -D define flags to the compilation of source files.
    52         ADD_DEFINITIONS("-DCPPAD_IPOPT_TEST")
    53         # add ipopt (and libraries it depends on) to list of libraries
    54         SET(test_more_ipopt ${ipopt_LIBRARIES} )
    55 ELSE ( ipopt_prefix )
    56         SET(ipopt_sources "")
    57         SET(test_more_ipopt "")
    58 ENDIF ( ipopt_prefix )
     31# ipopt_prefix
     32SET(sources ipopt_solve.cpp)
     33sources_libs_define(ipopt "${sources}" "${ipopt_LIBRARIES}" IPOPT_TEST)
    5934
    6035# sources that use eigen
    6136IF ( eigen_prefix )
    6237        # compile eigen library separately so can use different compiler flags
    63         ADD_LIBRARY(test_more_eigen EXCLUDE_FROM_ALL cppad_eigen.cpp)
     38        ADD_LIBRARY(test_more_eigen_lib EXCLUDE_FROM_ALL
     39                cppad_eigen.cpp
     40        )
    6441        # Adds -D define flags to the compilation of source files.
    6542        ADD_DEFINITIONS("-DCPPAD_EIGEN_TEST")
    6643        # Add other compiler flags
    67         add_cppad_cxx_flags(test_more_eigen)
     44        add_cppad_cxx_flags(test_more_eigen_lib)
    6845        #
    6946        # Add eigen to list of libraries
    70         SET(test_more_eigen test_more_eigen)
     47        SET(eigen_libs test_more_eigen_lib)
    7148ELSE ( eigen_prefix )
    7249        SET(eigen_sources "")
    73         SET(test_more_eigen "")
     50        SET(eigen_libs "")
    7451ENDIF ( eigen_prefix )
    7552
     
    173150TARGET_LINK_LIBRARIES(test_more
    174151        ${colpack_libs}
    175         ${test_more_adolc}
    176         ${test_more_ipopt}
    177         ${test_more_eigen}
     152        ${adolc_libs}
     153        ${ipopt_libs}
     154        ${eigen_libs}
    178155)
    179156
    180157# Add the check_test_more target
    181 ADD_CUSTOM_TARGET(
    182         check_test_more test_more DEPENDS test_more ${test_more_eigen}
    183 )
     158ADD_CUSTOM_TARGET( check_test_more test_more DEPENDS test_more )
Note: See TracChangeset for help on using the changeset viewer.