mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Separate out setting properties for openmc executable
This commit is contained in:
parent
bd85855f12
commit
3b806c8e44
1 changed files with 19 additions and 18 deletions
|
|
@ -454,31 +454,23 @@ set(LIBOPENMC_CXX_SRC
|
|||
add_library(libopenmc SHARED ${LIBOPENMC_FORTRAN_SRC} ${LIBOPENMC_CXX_SRC})
|
||||
set_target_properties(libopenmc PROPERTIES
|
||||
OUTPUT_NAME openmc
|
||||
PUBLIC_HEADER include/openmc.h)
|
||||
add_executable(openmc src/main.cpp)
|
||||
PUBLIC_HEADER include/openmc.h
|
||||
LINKER_LANGUAGE Fortran)
|
||||
|
||||
#===============================================================================
|
||||
# Add compiler/linker flags
|
||||
#===============================================================================
|
||||
|
||||
set_property(TARGET openmc libopenmc
|
||||
PROPERTY LINKER_LANGUAGE Fortran)
|
||||
|
||||
target_include_directories(libopenmc PUBLIC include ${HDF5_INCLUDE_DIRS})
|
||||
|
||||
# The executable and the faddeeva package use only one language. They can be
|
||||
# set via target_compile_options which accepts a list.
|
||||
target_compile_options(openmc PUBLIC ${cxxflags})
|
||||
|
||||
# The libopenmc library has both F90 and C++ so the compile flags must be set
|
||||
# file-by-file via set_source_file_properties. The compile flags must first be
|
||||
# converted from lists to strings.
|
||||
string(REPLACE ";" " " f90flags "${f90flags}")
|
||||
string(REPLACE ";" " " cxxflags "${cxxflags}")
|
||||
set_source_files_properties(${LIBOPENMC_FORTRAN_SRC} PROPERTIES COMPILE_FLAGS
|
||||
${f90flags})
|
||||
set_source_files_properties(${LIBOPENMC_CXX_SRC} PROPERTIES COMPILE_FLAGS
|
||||
${cxxflags})
|
||||
# file-by-file via set_source_file_properties.
|
||||
set_property(
|
||||
SOURCE ${LIBOPENMC_FORTRAN_SRC}
|
||||
PROPERTY COMPILE_OPTIONS ${f90flags})
|
||||
set_property(
|
||||
SOURCE ${LIBOPENMC_CXX_SRC}
|
||||
PROPERTY COMPILE_OPTIONS ${cxxflags})
|
||||
|
||||
# Add HDF5 library directories to link line with -L
|
||||
foreach(LIBDIR ${HDF5_LIBRARY_DIRS})
|
||||
|
|
@ -489,7 +481,16 @@ endforeach()
|
|||
# linker flags. Thus, we can pass both linker flags and libraries together.
|
||||
target_link_libraries(libopenmc ${ldflags} ${HDF5_LIBRARIES} pugixml
|
||||
faddeeva)
|
||||
target_link_libraries(openmc ${ldflags} libopenmc)
|
||||
|
||||
#===============================================================================
|
||||
# openmc executable
|
||||
#===============================================================================
|
||||
|
||||
add_executable(openmc src/main.cpp)
|
||||
target_compile_options(openmc PUBLIC ${cxxflags})
|
||||
target_link_libraries(openmc libopenmc)
|
||||
set_property(TARGET libopenmc
|
||||
PROPERTY LINKER_LANGUAGE Fortran)
|
||||
|
||||
#===============================================================================
|
||||
# Python package
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue