From 3b806c8e4415d235e216c97c05b0eb0ad0d4d135 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 20 Jun 2018 12:22:48 -0500 Subject: [PATCH] Separate out setting properties for openmc executable --- CMakeLists.txt | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23728e3a76..f0dac2c370 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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