20
20
## use this copy of the mmg distribution only if you accept them.
21
21
## =============================================================================
22
22
23
- CMAKE_MINIMUM_REQUIRED (VERSION 2.8.0 )
23
+ CMAKE_MINIMUM_REQUIRED (VERSION 2.8.12 )
24
24
25
25
# if PROJECT_NAME is defined, mmg is a subproject
26
26
if (DEFINED PROJECT_NAME )
@@ -190,6 +190,13 @@ IF ( BUILD_MMG3D OR BUILD_MMGS )
190
190
ELSE ()
191
191
SET (BUILD_MMGS3D OFF )
192
192
ENDIF ()
193
+
194
+ # Explicitly set the DNDEBUG flag in case the user or a parent project overrides
195
+ # it.
196
+ if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
197
+ add_definitions (-DNDEBUG)
198
+ endif ()
199
+
193
200
############################################################################
194
201
#####
195
202
##### Fortran header: libmmgtypesf.h
@@ -311,6 +318,9 @@ ENDFUNCTION()
311
318
312
319
OPTION (BUILD_SHARED_LIBS "Build shared libraries" OFF )
313
320
INVERT_BOOL("BUILD_STATIC_LIBS" ${BUILD_SHARED_LIBS} )
321
+ IF ( (${BUILD_STATIC_LIBS} EQUAL ON ) AND NOT CMAKE_POSITION_INDEPENDENT_CODE )
322
+ SET (CMAKE_POSITION_INDEPENDENT_CODE ON )
323
+ ENDIF ()
314
324
315
325
#------------------------------- mmg2d
316
326
CMAKE_DEPENDENT_OPTION ( LIBMMG2D_STATIC "Compile the mmg2d static library" ${BUILD_STATIC_LIBS}
@@ -425,6 +435,17 @@ CMAKE_DEPENDENT_OPTION(
425
435
###############################################################################
426
436
SET (LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR} /lib)
427
437
438
+ # CTEST_OUTPUT_DIR MUST BE SETTED HERE TO AVOID UNINITIALIZATION FOR LIBRARY
439
+ # TESTS DEFS
440
+ OPTION ( BUILD_TESTING "Enable/Disable continuous integration" OFF )
441
+
442
+ IF ( BUILD_TESTING )
443
+ SET ( CTEST_OUTPUT_DIR ${PROJECT_BINARY_DIR} /TEST_OUTPUTS
444
+ CACHE PATH "Path toward the tests outputs" )
445
+ MARK_AS_ADVANCED ( CTEST_OUTPUT_DIR )
446
+ FILE ( MAKE_DIRECTORY ${CTEST_OUTPUT_DIR} )
447
+ ENDIF ( )
448
+
428
449
IF ( BUILD_MMG2D )
429
450
INCLUDE (cmake/modules/mmg2d.cmake)
430
451
ENDIF ( )
@@ -443,7 +464,7 @@ ENDIF ( )
443
464
444
465
IF ( SCOTCH_FOUND )
445
466
# Include Scotch Dir here to ensure that Mmg doesn't search it's own headers in /usr/local
446
- INCLUDE_DIRECTORIES (PUBLIC ${SCOTCH_INCLUDE_DIRS} )
467
+ INCLUDE_DIRECTORIES (${SCOTCH_INCLUDE_DIRS} )
447
468
ENDIF ()
448
469
449
470
IF ( MmgTargetsExported )
@@ -473,8 +494,6 @@ ENDIF()
473
494
#####
474
495
###############################################################################
475
496
476
- OPTION ( BUILD_TESTING "Enable/Disable continuous integration" OFF )
477
-
478
497
CMAKE_DEPENDENT_OPTION (
479
498
ONLY_VERY_SHORT_TESTS "Enable/Disable very short tests" OFF
480
499
"BUILD_TESTING;NOT LONG_TESTS" OFF )
@@ -490,18 +509,12 @@ CMAKE_DEPENDENT_OPTION ( COVERAGE "Watch code coverage (Linux only)" OFF
490
509
491
510
IF ( BUILD_TESTING )
492
511
493
- SET ( CTEST_OUTPUT_DIR ${PROJECT_BINARY_DIR} /TEST_OUTPUTS
494
- CACHE PATH "Path toward the tests outputs" )
495
- MARK_AS_ADVANCED ( CTEST_OUTPUT_DIR )
496
-
497
- FILE ( MAKE_DIRECTORY ${CTEST_OUTPUT_DIR} )
498
-
499
512
IF ( NOT ONLY_VERY_SHORT_TESTS )
500
513
##-------------------------------------------------------------------##
501
514
##------- Get the continuous integration tests ----------------------##
502
515
##-------------------------------------------------------------------##
503
516
INCLUDE (cmake/modules/LoadCiTests.cmake)
504
- ENDIF ( )
517
+ ENDIF ( )
505
518
506
519
##-------------------------------------------------------------------##
507
520
##------- Set the continuous integration options --------------------##
@@ -555,18 +568,22 @@ ENDIF ( )
555
568
SET (LISTEXEC_MMG ${LISTEXEC_MMGS} ${LISTEXEC_MMG3D} )
556
569
SET (EXECUT_MMG ${EXECUT_MMGS} ${EXECUT_MMG3D} )
557
570
558
- # Change authorisations for some files...
559
- IF ( EXISTS ${CTEST_OUTPUT_DIR} /LeakCheck_AbnormalEnd7/unreadable.meshb)
560
- FILE (REMOVE ${CTEST_OUTPUT_DIR} /LeakCheck_AbnormalEnd7/unwrittable.meshb)
571
+ # Make some files not openable
572
+ IF ( EXISTS ${CTEST_OUTPUT_DIR} /unwrittable7.meshb
573
+ AND NOT IS_DIRECTORY ${CTEST_OUTPUT_DIR} /unwrittable7.meshb )
574
+ FILE ( REMOVE ${CTEST_OUTPUT_DIR} /unwrittable7.meshb )
575
+ ENDIF ()
576
+ IF ( NOT EXISTS ${CTEST_OUTPUT_DIR} /unwrittable7.meshb)
577
+ FILE (MAKE_DIRECTORY ${CTEST_OUTPUT_DIR} /unwrittable7.meshb)
561
578
ENDIF ()
562
- FILE (COPY ${MMG_CI_TESTS} /LeakCheck_AbnormalEnd7/dout.mesh
563
- DESTINATION ${CTEST_OUTPUT_DIR} /AbnormalEnd7/unwrittable.meshb)
564
579
565
- IF ( EXISTS ${CTEST_OUTPUT_DIR} /LeakCheck_AbnormalEnd8/unwrittable.sol)
566
- FILE (REMOVE ${CTEST_OUTPUT_DIR} /LeakCheck_AbnormalEnd8/unwrittable.sol)
580
+ IF ( EXISTS ${CTEST_OUTPUT_DIR} /unwrittable8.sol
581
+ AND NOT IS_DIRECTORY ${CTEST_OUTPUT_DIR} /unwrittable8.sol )
582
+ FILE ( REMOVE ${CTEST_OUTPUT_DIR} /unwrittable8.sol )
583
+ ENDIF ()
584
+ IF ( NOT EXISTS ${CTEST_OUTPUT_DIR} /unwrittable8.sol)
585
+ FILE (MAKE_DIRECTORY ${CTEST_OUTPUT_DIR} /unwrittable8.sol)
567
586
ENDIF ()
568
- FILE (COPY ${MMG_CI_TESTS} /LeakCheck_AbnormalEnd8/dsol.sol
569
- DESTINATION ${CTEST_OUTPUT_DIR} /AbnormalEnd8/unwrittable.sol)
570
587
571
588
# Add common tests for mmgs/3d appli
572
589
INCLUDE ( ${PROJECT_SOURCE_DIR} /cmake/testing/mmg_tests.cmake )
0 commit comments