Skip to content

Commit f4f6045

Browse files
authored
Rename CMake project from stdlib to fortran_stdlib (#290)
- match project name with name of produced library target - allows convenient reusing of the PROJECT_NAME variable in CMake and configure_file commands - might reduce risk for typos (PROJECT_NAME is highlighted, fortran_stdlib not) - also use PROJECT_NAME for library dependency when linking tests
1 parent c2a1957 commit f4f6045

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.14.0)
2-
project(stdlib Fortran)
2+
project(fortran_stdlib Fortran)
33
enable_testing()
44

55
# Follow GNU conventions for installation directories
@@ -56,7 +56,7 @@ endif()
5656

5757
add_subdirectory(src)
5858

59-
install(EXPORT fortran_stdlib-targets
60-
NAMESPACE fortran_stdlib::
61-
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/fortran_stdlib"
59+
install(EXPORT ${PROJECT_NAME}-targets
60+
NAMESPACE ${PROJECT_NAME}::
61+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
6262
)

src/CMakeLists.txt

+7-7
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,26 @@ set(SRC
4444
${outFiles}
4545
)
4646

47-
add_library(fortran_stdlib ${SRC})
47+
add_library(${PROJECT_NAME} ${SRC})
4848

4949
set(LIB_MOD_DIR ${CMAKE_CURRENT_BINARY_DIR}/mod_files/)
50-
set_target_properties(fortran_stdlib PROPERTIES
50+
set_target_properties(${PROJECT_NAME} PROPERTIES
5151
Fortran_MODULE_DIRECTORY ${LIB_MOD_DIR})
52-
target_include_directories(fortran_stdlib PUBLIC
52+
target_include_directories(${PROJECT_NAME} PUBLIC
5353
$<BUILD_INTERFACE:${LIB_MOD_DIR}>
5454
$<INSTALL_INTERFACE:include>
5555
)
5656

5757
if(f18errorstop)
58-
target_sources(fortran_stdlib PRIVATE f18estop.f90)
58+
target_sources(${PROJECT_NAME} PRIVATE f18estop.f90)
5959
else()
60-
target_sources(fortran_stdlib PRIVATE f08estop.f90)
60+
target_sources(${PROJECT_NAME} PRIVATE f08estop.f90)
6161
endif()
6262

6363
add_subdirectory(tests)
6464

65-
install(TARGETS fortran_stdlib
66-
EXPORT fortran_stdlib-targets
65+
install(TARGETS ${PROJECT_NAME}
66+
EXPORT ${PROJECT_NAME}-targets
6767
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
6868
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
6969
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"

src/tests/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
macro(ADDTEST name)
22
add_executable(test_${name} test_${name}.f90)
3-
target_link_libraries(test_${name} fortran_stdlib)
3+
target_link_libraries(test_${name} ${PROJECT_NAME})
44
add_test(NAME ${name}
55
COMMAND $<TARGET_FILE:test_${name}> ${CMAKE_CURRENT_BINARY_DIR}
66
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

src/tests/system/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
add_executable(test_sleep test_sleep.f90)
2-
target_link_libraries(test_sleep fortran_stdlib)
2+
target_link_libraries(test_sleep ${PROJECT_NAME})
33

44
add_test(NAME Sleep COMMAND $<TARGET_FILE:test_sleep> 350)
5-
set_tests_properties(Sleep PROPERTIES TIMEOUT 1)
5+
set_tests_properties(Sleep PROPERTIES TIMEOUT 1)

0 commit comments

Comments
 (0)