Commit b4bc9761 authored by jcfr's avatar jcfr

BUG: Fix windows assert associated with extension tests

To ensure existing tests pass, the Cxx folder has been added to the list
of sub dirs to consider when looking up IntDir.

That said, the recommended solution is to set the target property
RUNTIME_OUTPUT_DIRECTORY for the test executable. The value of this property
should be ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR}

See http://na-mic.org/Mantis/view.php?id=2348

Fixes #2348

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21200 3bd1e089-480b-0410-8dfb-8563597acbee
parent 5bfc2e59
...@@ -329,12 +329,16 @@ QString qSlicerCoreApplicationPrivate::discoverSlicerHomeDirectory() ...@@ -329,12 +329,16 @@ QString qSlicerCoreApplicationPrivate::discoverSlicerHomeDirectory()
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
Q_Q(qSlicerCoreApplication); Q_Q(qSlicerCoreApplication);
if (this->IntDir.isEmpty()) if (!this->isInstalled(slicerHome))
{ {
qSlicerUtils::pathWithoutIntDir(q->applicationDirPath(), Slicer_BIN_DIR, this->IntDir); foreach(const QString& subDir,
if (this->IntDir.isEmpty()) QStringList() << Slicer_BIN_DIR << Slicer_CLIMODULES_BIN_DIR << "Cxx")
{ {
qSlicerUtils::pathWithoutIntDir(q->applicationDirPath(), Slicer_CLIMODULES_BIN_DIR, this->IntDir); qSlicerUtils::pathWithoutIntDir(q->applicationDirPath(), subDir, this->IntDir);
if (!this->IntDir.isEmpty())
{
break;
}
} }
} }
Q_ASSERT(this->isInstalled(slicerHome) ? this->IntDir.isEmpty() : !this->IntDir.isEmpty()); Q_ASSERT(this->isInstalled(slicerHome) ? this->IntDir.isEmpty() : !this->IntDir.isEmpty());
......
...@@ -487,9 +487,9 @@ file(WRITE "${Slicer_BINARY_DIR}/SlicerTargets.cmake" ...@@ -487,9 +487,9 @@ file(WRITE "${Slicer_BINARY_DIR}/SlicerTargets.cmake"
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Output directories. # Output directories.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Slicer_BINARY_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Slicer_BINARY_DIR}/${Slicer_BIN_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${Slicer_BINARY_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${Slicer_BINARY_DIR}/${Slicer_BIN_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${Slicer_BINARY_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${Slicer_BINARY_DIR}/${Slicer_LIB_DIR})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Slicer Home # Slicer Home
......
...@@ -18,6 +18,7 @@ list(APPEND Tests ${KIT_TEST_SRCS}) ...@@ -18,6 +18,7 @@ list(APPEND Tests ${KIT_TEST_SRCS})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
......
...@@ -18,6 +18,7 @@ list(APPEND Tests ${KIT_TEST_SRCS}) ...@@ -18,6 +18,7 @@ list(APPEND Tests ${KIT_TEST_SRCS})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
......
...@@ -49,6 +49,7 @@ set(TestsToRun ${Tests}) ...@@ -49,6 +49,7 @@ set(TestsToRun ${Tests})
list(REMOVE_ITEM TestsToRun ${KIT}CxxTests.cxx) list(REMOVE_ITEM TestsToRun ${KIT}CxxTests.cxx)
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
set(target_libraries set(target_libraries
qSlicerAnnotationsModuleWidgets qSlicerAnnotationsModuleWidgets
......
...@@ -17,6 +17,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX}) ...@@ -17,6 +17,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX})
list(APPEND Tests ${KIT_TEST_SRCS}) list(APPEND Tests ${KIT_TEST_SRCS})
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
foreach(testname ${KIT_TEST_NAMES}) foreach(testname ${KIT_TEST_NAMES})
......
...@@ -15,6 +15,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX}) ...@@ -15,6 +15,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX})
list(APPEND Tests ${KIT_TEST_SRCS}) list(APPEND Tests ${KIT_TEST_SRCS})
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
foreach(testname ${KIT_TEST_NAMES}) foreach(testname ${KIT_TEST_NAMES})
......
...@@ -15,6 +15,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX}) ...@@ -15,6 +15,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX})
list(APPEND Tests ${KIT_TEST_SRCS}) list(APPEND Tests ${KIT_TEST_SRCS})
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
foreach(testname ${KIT_TEST_NAMES}) foreach(testname ${KIT_TEST_NAMES})
......
...@@ -16,6 +16,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX}) ...@@ -16,6 +16,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX})
list(APPEND Tests ${KIT_TEST_SRCS}) list(APPEND Tests ${KIT_TEST_SRCS})
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
foreach(testname ${KIT_TEST_NAMES}) foreach(testname ${KIT_TEST_NAMES})
......
set(KIT qSlicer${MODULE_NAME}Module) set(KIT qSlicer${MODULE_NAME}Module)
#-----------------------------------------------------------------------------
set(KIT_TEST_SRCS) set(KIT_TEST_SRCS)
set(KIT_TEST_NAMES) set(KIT_TEST_NAMES)
set(KIT_TEST_NAMES_CXX) set(KIT_TEST_NAMES_CXX)
SlicerMacroConfigureGenericCxxModuleTests(${MODULE_NAME} KIT_TEST_SRCS KIT_TEST_NAMES KIT_TEST_NAMES_CXX) SlicerMacroConfigureGenericCxxModuleTests(${MODULE_NAME} KIT_TEST_SRCS KIT_TEST_NAMES KIT_TEST_NAMES_CXX)
#-----------------------------------------------------------------------------
#set(CMAKE_TESTDRIVER_BEFORE_TESTMAIN "DEBUG_LEAKS_ENABLE_EXIT_ERROR();" ) #set(CMAKE_TESTDRIVER_BEFORE_TESTMAIN "DEBUG_LEAKS_ENABLE_EXIT_ERROR();" )
create_test_sourcelist(Tests ${KIT}CxxTests.cxx create_test_sourcelist(Tests ${KIT}CxxTests.cxx
${KIT_TEST_NAMES_CXX} ${KIT_TEST_NAMES_CXX}
...@@ -16,11 +14,10 @@ create_test_sourcelist(Tests ${KIT}CxxTests.cxx ...@@ -16,11 +14,10 @@ create_test_sourcelist(Tests ${KIT}CxxTests.cxx
list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX}) list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX})
list(APPEND Tests ${KIT_TEST_SRCS}) list(APPEND Tests ${KIT_TEST_SRCS})
#-----------------------------------------------------------------------------
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
#-----------------------------------------------------------------------------
foreach(testname ${KIT_TEST_NAMES}) foreach(testname ${KIT_TEST_NAMES})
SIMPLE_TEST( ${testname} ) SIMPLE_TEST( ${testname} )
endforeach() endforeach()
......
...@@ -14,6 +14,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX}) ...@@ -14,6 +14,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX})
list(APPEND Tests ${KIT_TEST_SRCS}) list(APPEND Tests ${KIT_TEST_SRCS})
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
foreach(testname ${KIT_TEST_NAMES}) foreach(testname ${KIT_TEST_NAMES})
......
...@@ -18,6 +18,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX}) ...@@ -18,6 +18,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX})
list(APPEND Tests ${KIT_TEST_SRCS}) list(APPEND Tests ${KIT_TEST_SRCS})
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
foreach(testname ${KIT_TEST_NAMES}) foreach(testname ${KIT_TEST_NAMES})
......
...@@ -15,6 +15,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX}) ...@@ -15,6 +15,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX})
list(APPEND Tests ${KIT_TEST_SRCS}) list(APPEND Tests ${KIT_TEST_SRCS})
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
foreach(testname ${KIT_TEST_NAMES}) foreach(testname ${KIT_TEST_NAMES})
......
...@@ -15,6 +15,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX}) ...@@ -15,6 +15,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX})
list(APPEND Tests ${KIT_TEST_SRCS}) list(APPEND Tests ${KIT_TEST_SRCS})
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
foreach(testname ${KIT_TEST_NAMES}) foreach(testname ${KIT_TEST_NAMES})
......
...@@ -15,6 +15,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX}) ...@@ -15,6 +15,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX})
list(APPEND Tests ${KIT_TEST_SRCS}) list(APPEND Tests ${KIT_TEST_SRCS})
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
foreach(testname ${KIT_TEST_NAMES}) foreach(testname ${KIT_TEST_NAMES})
......
...@@ -15,6 +15,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX}) ...@@ -15,6 +15,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX})
list(APPEND Tests ${KIT_TEST_SRCS}) list(APPEND Tests ${KIT_TEST_SRCS})
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
foreach(testname ${KIT_TEST_NAMES}) foreach(testname ${KIT_TEST_NAMES})
......
...@@ -16,6 +16,7 @@ list(APPEND Tests ${KIT_TEST_SRCS}) ...@@ -16,6 +16,7 @@ list(APPEND Tests ${KIT_TEST_SRCS})
set(LIBRARY_NAME ${lib_name}) set(LIBRARY_NAME ${lib_name})
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
foreach(testname ${KIT_TEST_NAMES}) foreach(testname ${KIT_TEST_NAMES})
......
...@@ -21,6 +21,7 @@ include_directories( ...@@ -21,6 +21,7 @@ include_directories(
) )
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT} vtkSlicerVolumesModuleLogic) target_link_libraries(${KIT}CxxTests ${KIT} vtkSlicerVolumesModuleLogic)
foreach(testname ${KIT_TEST_NAMES}) foreach(testname ${KIT_TEST_NAMES})
......
...@@ -21,6 +21,7 @@ QT4_GENERATE_MOCS( ...@@ -21,6 +21,7 @@ QT4_GENERATE_MOCS(
include_directories( ${CMAKE_CURRENT_BINARY_DIR}) include_directories( ${CMAKE_CURRENT_BINARY_DIR})
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
foreach(testname ${KIT_TEST_NAMES}) foreach(testname ${KIT_TEST_NAMES})
......
...@@ -16,6 +16,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX}) ...@@ -16,6 +16,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX})
list(APPEND Tests ${KIT_TEST_SRCS}) list(APPEND Tests ${KIT_TEST_SRCS})
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
foreach(testname ${KIT_TEST_NAMES}) foreach(testname ${KIT_TEST_NAMES})
......
...@@ -29,6 +29,7 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}) ...@@ -29,6 +29,7 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR})
set(LIBRARY_NAME ${PROJECT_NAME}) set(LIBRARY_NAME ${PROJECT_NAME})
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT} vtkSlicerVolumesModuleLogic) target_link_libraries(${KIT}CxxTests ${KIT} vtkSlicerVolumesModuleLogic)
set(VOLUME_FILE "${MRMLCore_SOURCE_DIR}/Testing/TestData/fixed.nrrd") set(VOLUME_FILE "${MRMLCore_SOURCE_DIR}/Testing/TestData/fixed.nrrd")
......
...@@ -18,6 +18,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX}) ...@@ -18,6 +18,7 @@ list(REMOVE_ITEM Tests ${KIT_TEST_NAMES_CXX})
list(APPEND Tests ${KIT_TEST_SRCS}) list(APPEND Tests ${KIT_TEST_SRCS})
add_executable(${KIT}CxxTests ${Tests}) add_executable(${KIT}CxxTests ${Tests})
set_target_properties(${KIT}CxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}CxxTests ${KIT}) target_link_libraries(${KIT}CxxTests ${KIT})
set(VOLUME_FILE "${MRMLCore_SOURCE_DIR}/Testing/TestData/fixed.nrrd") set(VOLUME_FILE "${MRMLCore_SOURCE_DIR}/Testing/TestData/fixed.nrrd")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment