working on fortran/test integration

git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@9361 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
Scott R Charlton 2015-03-14 01:24:18 +00:00
parent 68cb2cc5e5
commit 13c3a32e13

112
tests/CMakeLists.txt Normal file
View File

@ -0,0 +1,112 @@
##
## Configure files
##
# tests/ex2
configure_file (
"ex2.in"
"ex2"
)
# tests/phreeqc.dat
configure_file (
"phreeqc.dat.in"
"phreeqc.dat"
)
##
## Test C
##
project(test_c C)
# source
SET(test_c_SOURCES
test_c.c
)
# test executable
add_executable(test_c ${test_c_SOURCES})
# library dependencies
SET(EXTRA_LIBS ${EXTRA_LIBS} IPhreeqc)
# link
target_link_libraries(test_c ${EXTRA_LIBS})
# test compile and run
add_test(TestCompileAndRunC test_c)
if (MSVC AND BUILD_SHARED_LIBS)
# copy dll
add_custom_command(TARGET test_c POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:IPhreeqc> $<TARGET_FILE_DIR:test_c>
)
endif()
##
## Test CXX
##
project(test_cxx CXX)
# source
SET(test_cxx_SOURCES
test_cxx.cxx
)
# test executable
add_executable(test_cxx ${test_cxx_SOURCES})
# library dependencies
SET(EXTRA_LIBS ${EXTRA_LIBS} IPhreeqc)
# link
target_link_libraries(test_cxx ${EXTRA_LIBS})
# test compile and run
add_test(TestCompileAndRunCXX test_cxx)
if (MSVC AND BUILD_SHARED_LIBS)
# copy dll
add_custom_command(TARGET test_cxx POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:IPhreeqc> $<TARGET_FILE_DIR:test_cxx>
)
endif()
##
## Test Fortran
##
if (IPHREEQC_BUILD_FORTRAN)
project(test_f90 Fortran)
# source
SET(test_f90_SOURCES
../src/IPhreeqc_interface.F90
main.f90
test_f90.f90
)
# test executable
add_executable(test_f90 ${test_f90_SOURCES})
# library dependencies
SET(EXTRA_LIBS ${EXTRA_LIBS} IPhreeqc)
# link
target_link_libraries(test_f90 ${EXTRA_LIBS})
# test compile and run
add_test(TestCompileAndRunFortran test_f90)
if (MSVC AND BUILD_SHARED_LIBS)
# copy dll
add_custom_command(TARGET test_f90 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:IPhreeqc> $<TARGET_FILE_DIR:test_f90>
)
endif()
endif()