Skip to content

Commit

Permalink
Localize CMake source file inclusion for the API tester
Browse files Browse the repository at this point in the history
  • Loading branch information
godotalgorithm committed Nov 8, 2024
1 parent 6ccf65d commit cd0d325
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ if(TESTS)
message(FATAL_ERROR "Python3 and Numpy are required for MOPAC testing (testing can be disabled with -DTESTS=OFF)")
endif()
enable_testing()
add_executable(mopac-api-test)
target_link_libraries(mopac-api-test mopac-core)
add_subdirectory(include)
add_subdirectory(tests)
endif()

Expand Down
18 changes: 18 additions & 0 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Molecular Orbital PACkage (MOPAC)
# Copyright (C) 2021, Virginia Polytechnic Institute and State University
#
# MOPAC is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# MOPAC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

target_sources(mopac-api-test PRIVATE mopac_api_f.F90)
target_sources(mopac-api-test PRIVATE mopac_api_internal.F90)
19 changes: 1 addition & 18 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,7 @@ macro(add_mopac_test _name _files)
${CMAKE_BINARY_DIR}/mopac${CMAKE_EXECUTABLE_SUFFIX} ${HOF_ERROR} ${_files})
endmacro()

#===============================================
add_executable(mopac-api-test)
target_link_libraries(mopac-api-test mopac-core)
if (STATIC_BUILD)
target_link_options(mopac-api-test PUBLIC "-static")
endif()
# Create a list of source files (src_list) with the .F90 extension
set(src_list
mopac_api_test
)
#-----------------------------------------------
# Add a list of source files to the target
foreach(idx IN LISTS src_list)
target_sources(mopac-api-test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/${idx}.F90)
endforeach()
target_sources(mopac-api-test PRIVATE ${CMAKE_SOURCE_DIR}/include/mopac_api_internal.F90)
target_sources(mopac-api-test PRIVATE ${CMAKE_SOURCE_DIR}/include/mopac_api_f.F90)
#===============================================
target_sources(mopac-api-test PRIVATE mopac_api_test.F90)

add_subdirectory(INDO-dev)
add_subdirectory(keywords)
Expand Down

0 comments on commit cd0d325

Please sign in to comment.