@@ -260,15 +260,19 @@ endif()
260
260
if (LIBINT2_BUILD_SHARED_AND_STATIC_LIBS)
261
261
add_library(libint2 SHARED $<TARGET_OBJECTS:libint2_obj>)
262
262
set_target_properties(libint2 PROPERTIES LIBRARY_OUTPUT_NAME int2 VERSION ${LIBINT_VERSION} SOVERSION 2)
263
- if(MSVC )
263
+ if(WIN32 )
264
264
target_compile_definitions(libint2 PUBLIC _USE_MATH_DEFINES)
265
- target_compile_options(libint2 PUBLIC "/EHsc")
265
+ if(MSVC)
266
+ target_compile_options(libint2 PUBLIC "/EHsc")
267
+ endif()
266
268
endif()
267
269
add_library(libint2-static STATIC $<TARGET_OBJECTS:libint2_obj>)
268
270
set_target_properties(libint2-static PROPERTIES ARCHIVE_OUTPUT_NAME int2)
269
- if(MSVC )
271
+ if(WIN32 )
270
272
target_compile_definitions(libint2-static PUBLIC _USE_MATH_DEFINES)
271
- target_compile_options(libint2-static PUBLIC "/EHsc")
273
+ if(MSVC)
274
+ target_compile_options(libint2-static PUBLIC "/EHsc")
275
+ endif()
272
276
endif()
273
277
target_include_directories(libint2-static INTERFACE
274
278
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
@@ -281,17 +285,17 @@ if (LIBINT2_BUILD_SHARED_AND_STATIC_LIBS)
281
285
# Add libraries to the list of installed components
282
286
install(TARGETS libint2-static EXPORT libint2
283
287
COMPONENT libint2
288
+ RUNTIME DESTINATION "${LIBINT2_INSTALL_BINDIR}"
284
289
LIBRARY DESTINATION "${LIBINT2_INSTALL_LIBDIR}"
285
290
ARCHIVE DESTINATION "${LIBINT2_INSTALL_LIBDIR}"
286
291
# includes are installed by the include/CMakeLists.txt.include.export
287
292
# INCLUDES DESTINATION "${LIBINT2_INSTALL_INCLUDEDIR}"
288
293
)
289
294
else()
290
295
add_library(libint2 $<TARGET_OBJECTS:libint2_obj>)
296
+ set_target_properties(libint2 PROPERTIES OUTPUT_NAME int2)
291
297
if (BUILD_SHARED_LIBS)
292
- set_target_properties(libint2 PROPERTIES LIBRARY_OUTPUT_NAME int2 VERSION ${LIBINT_VERSION} SOVERSION 2)
293
- else(BUILD_SHARED_LIBS)
294
- set_target_properties(libint2 PROPERTIES ARCHIVE_OUTPUT_NAME int2)
298
+ set_target_properties(libint2 PROPERTIES VERSION ${LIBINT_VERSION} SOVERSION 2)
295
299
endif(BUILD_SHARED_LIBS)
296
300
endif()
297
301
# In any case, there will exist a target named "int2": diminish code length by
@@ -309,6 +313,7 @@ add_library(Libint2::int2 ALIAS libint2)
309
313
# Add libraries to the list of installed components
310
314
install(TARGETS libint2 EXPORT libint2
311
315
COMPONENT libint2
316
+ RUNTIME DESTINATION "${LIBINT2_INSTALL_BINDIR}"
312
317
LIBRARY DESTINATION "${LIBINT2_INSTALL_LIBDIR}"
313
318
ARCHIVE DESTINATION "${LIBINT2_INSTALL_LIBDIR}"
314
319
# includes are installed by the include/CMakeLists.txt.include.export
@@ -346,13 +351,18 @@ if (LIBINT_HAS_CXX_API)
346
351
if (LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS)
347
352
target_link_libraries(libint2_cxx INTERFACE Boost::headers)
348
353
endif(LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS)
349
- if(MSVC)
350
- # MSVC does not include <cmath> constants, unless _USE_MATH_DEFINES is defined.
354
+ if(WIN32)
355
+ # Windows does not include <cmath> constants, unless _USE_MATH_DEFINES is defined.
356
+ target_compile_definitions(
357
+ libint2_cxx
358
+ INTERFACE
359
+ _USE_MATH_DEFINES
360
+ )
361
+ if(MSVC)
351
362
# _CRT_* to squash some getenv, strdup, strncpy, ctime, fopen warnings
352
363
target_compile_definitions(
353
364
libint2_cxx
354
365
INTERFACE
355
- _USE_MATH_DEFINES
356
366
_CRT_NONSTDC_NO_DEPRECATE
357
367
_CRT_NONSTDC_NO_WARNINGS
358
368
_CRT_SECURE_NO_WARNINGS
@@ -363,6 +373,7 @@ if (LIBINT_HAS_CXX_API)
363
373
INTERFACE
364
374
"/EHsc"
365
375
)
376
+ endif()
366
377
endif()
367
378
get_filename_component(DATADIR_ABSOLUTE "${CMAKE_INSTALL_PREFIX}/${LIBINT2_INSTALL_DATADIR}" ABSOLUTE)
368
379
target_compile_definitions(libint2_cxx INTERFACE
@@ -383,6 +394,7 @@ if (LIBINT_HAS_CXX_API)
383
394
# Add library to the list of installed components
384
395
install(TARGETS libint2_cxx EXPORT libint2
385
396
COMPONENT cxx
397
+ RUNTIME DESTINATION "${LIBINT2_INSTALL_BINDIR}"
386
398
LIBRARY DESTINATION "${LIBINT2_INSTALL_LIBDIR}"
387
399
ARCHIVE DESTINATION "${LIBINT2_INSTALL_LIBDIR}"
388
400
# includes are installed by the include/CMakeLists.txt.include.export
@@ -400,10 +412,12 @@ add_custom_target_subproject(libint2 check USES_TERMINAL COMMAND ${CMAKE_CTEST_C
400
412
add_executable(eritest-libint2 EXCLUDE_FROM_ALL tests/eri/test.cc)
401
413
target_link_libraries(eritest-libint2 ${int2_library})
402
414
target_include_directories(eritest-libint2 PRIVATE ${PROJECT_SOURCE_DIR}/tests/eri)
403
- if(MSVC)
404
- # TODO on future target pass, def should be added to the L2 target, not added to test
405
- target_compile_definitions(eritest-libint2 PUBLIC _USE_MATH_DEFINES)
415
+ if(WIN32)
416
+ # TODO on future target pass, def should be added to the L2 target, not added to test
417
+ target_compile_definitions(eritest-libint2 PUBLIC _USE_MATH_DEFINES)
418
+ if(MSVC)
406
419
target_compile_options(eritest-libint2 PUBLIC "/EHsc")
420
+ endif()
407
421
endif()
408
422
409
423
add_test(libint2/eritest/build "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target eritest-libint2)
@@ -514,8 +528,8 @@ if (ENABLE_FORTRAN)
514
528
# specify the location of modules
515
529
set(CMAKE_Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/fortran/modules/")
516
530
517
- # preprocess libint2.h ... this is a guess for UNIX systems only
518
- if (UNIX )
531
+ # preprocess libint2.h ... this is a guess for non-MSVC compilers
532
+ if (NOT MSVC )
519
533
520
534
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/fortran)
521
535
@@ -527,7 +541,7 @@ if (ENABLE_FORTRAN)
527
541
COMMENT "Generating libint2.h.i"
528
542
)
529
543
else()
530
- message(FATAL_ERROR "Cannot run preprocessor on non-Unix systems , disable Fortran to proceed")
544
+ message(FATAL_ERROR "Cannot run preprocessor with MSVC compilers , disable Fortran to proceed")
531
545
endif()
532
546
533
547
# translated Libint_t
0 commit comments